mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
iio: magnetometer: ak8975: check if gpiod read was successful
Add a check that ensures that valid data has been read from GPIOD. If not, log an error and return the negative read value. Suggested-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Maxwell Doose <m32285159@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
cfa30b4330
commit
46dd701a39
|
|
@ -658,6 +658,10 @@ static int wait_conversion_complete_gpio(struct ak8975_data *data,
|
|||
timeout_ms * USEC_PER_MSEC);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (val < 0) {
|
||||
dev_err(&client->dev, "Error in reading GPIOD\n");
|
||||
return val;
|
||||
}
|
||||
|
||||
ret = i2c_smbus_read_byte_data(client, data->def->ctrl_regs[ST1]);
|
||||
if (ret < 0)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user