Commit 282bad2e authored by Simon Horman's avatar Simon Horman Committed by Greg Kroah-Hartman
Browse files

ice: Don't dereference NULL in ice_gnss_read error path

[ Upstream commit 05a1308a2e08e4a375bf60eb4c6c057a201d81fc ]

If pf is NULL in ice_gnss_read() then it will be dereferenced
in the error path by a call to dev_dbg(ice_pf_to_dev(pf), ...).

Avoid this by simply returning in this case.
If logging is desired an alternate approach might be to
use pr_err() before returning.

Flagged by Smatch as:

  .../ice_gnss.c:196 ice_gnss_read() error: we previously assumed 'pf' could be null (see line 131)

Fixes: 43113ff7

 ("ice: add TTY for GNSS module for E810T device")
Signed-off-by: default avatarSimon Horman <horms@kernel.org>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel)
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8b71592a
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment