Skip to content

Commit

Permalink
drivers: misc: ad525x_dpot: Add missing check in dpot_read_spi
Browse files Browse the repository at this point in the history
The use of dpot_read_r8d8() after checking dpot->uid is similar.
However, we check the return value and return an error code only
in one path, which is odd.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dinghao Liu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
dinghaoliu authored and gregkh committed Mar 10, 2021
1 parent bc63501 commit f8096ff
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/misc/ad525x_dpot.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ static s32 dpot_read_spi(struct dpot_data *dpot, u8 reg)
value = dpot_read_r8d8(dpot,
DPOT_AD5291_READ_RDAC << 2);

if (value < 0)
return value;

if (dpot->uid == DPOT_UID(AD5291_ID))
value = value >> 2;

Expand Down

0 comments on commit f8096ff

Please sign in to comment.