diff mbox series

iio: gyro: mpu3050: Fix error handling in mpu3050_trigger_handler

Message ID 20210301080421.13436-1-dinghao.liu@zju.edu.cn (mailing list archive)
State New
Headers show
Series iio: gyro: mpu3050: Fix error handling in mpu3050_trigger_handler | expand

Commit Message

Dinghao Liu March 1, 2021, 8:04 a.m. UTC
There is one regmap_bulk_read() call in mpu3050_trigger_handler
that we have caught its return value bug lack further handling.
Check and terminate the execution flow just like the other three
regmap_bulk_read() calls in this function.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/iio/gyro/mpu3050-core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Linus Walleij March 2, 2021, 3:45 p.m. UTC | #1
On Mon, Mar 1, 2021 at 9:04 AM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:

> There is one regmap_bulk_read() call in mpu3050_trigger_handler
> that we have caught its return value bug lack further handling.
> Check and terminate the execution flow just like the other three
> regmap_bulk_read() calls in this function.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

OK that makes sense.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Jonathan Cameron March 6, 2021, 5:16 p.m. UTC | #2
On Tue, 2 Mar 2021 16:45:10 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Mon, Mar 1, 2021 at 9:04 AM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
> 
> > There is one regmap_bulk_read() call in mpu3050_trigger_handler
> > that we have caught its return value bug lack further handling.
> > Check and terminate the execution flow just like the other three
> > regmap_bulk_read() calls in this function.
> >
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>  
> 
> OK that makes sense.
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Applied with a fixes tag (it goes all the way back) and marked
for stable.

Thanks,

Jonathan

> 
> Yours,
> Linus Walleij
diff mbox series

Patch

diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index dfa31a23500f..ac90be03332a 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -551,6 +551,8 @@  static irqreturn_t mpu3050_trigger_handler(int irq, void *p)
 					       MPU3050_FIFO_R,
 					       &fifo_values[offset],
 					       toread);
+			if (ret)
+				goto out_trigger_unlock;
 
 			dev_dbg(mpu3050->dev,
 				"%04x %04x %04x %04x %04x\n",