[PATCH 5.12 044/677] iio: magnetometer: yas530: Fix return value on error path

From: Greg Kroah-Hartman
Date: Wed May 12 2021 - 14:06:49 EST


From: Linus Walleij <linus.walleij@xxxxxxxxxx>

commit e64837bf9e2c063d6b5bab51c0554a60270f636d upstream.

There was a missed return variable assignment in the
default errorpath of the switch statement in yas5xx_probe().
Fix it.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Suggested-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20210215153023.47899-1-linus.walleij@xxxxxxxxxx
Cc: <Stable@xxxxxxxxxxxxxxx>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/iio/magnetometer/yamaha-yas530.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/iio/magnetometer/yamaha-yas530.c
+++ b/drivers/iio/magnetometer/yamaha-yas530.c
@@ -888,6 +888,7 @@ static int yas5xx_probe(struct i2c_clien
strncpy(yas5xx->name, "yas532", sizeof(yas5xx->name));
break;
default:
+ ret = -ENODEV;
dev_err(dev, "unhandled device ID %02x\n", yas5xx->devid);
goto assert_reset;
}