gpio: sx150x: fix error code value
Subsystems (2)
PATCH 1/1 gpio: sx150x: fix error code value
The return code of sx150x_get_io() is propagated as error code, so it should look like standard code.
Signed-off-by Vasiliy Kulikov <[email protected]>
---
Compile tested.
drivers/gpio/sx150x.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/sx150x.c +1 -1
@@ -179,7 +179,7 @@ static int sx150x_get_io(struct sx150x_chip *chip, unsigned offset)sx150x_find_cfg (offset,1 , ®, &mask, &shift); err =sx150x_i2c_read (chip->client, reg, &data);if (err >=0 ) - err = (data & mask) !=0 ?1 :0 ; + err = (data & mask) !=0 ? -EIO :0 ;return err; }
Signature · 1 line
1.7.0.4
Review
Quoted 5 lines
err = sx150x_i2c_read(chip->client, reg,&data); if (err>= 0)(quoted diff) +1
-1- err = (data& mask) != 0 ? 1 : 0; + err = (data& mask) != 0 ? -EIO : 0;
This doesn't work. The IO pins are gpio data pins, which are used as 0 or 1 data values (see sx150x_gpio_get). Returning -EIO whenever an attempt is made to gpio_get_value on a non-zero gpio line will break things.
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.