mfd: max8997: Enforce mfd_add_devices() return value check
PATCH 1/1 mfd: max8997: Enforce mfd_add_devices() return value check
The original author provided a random return value check which is redundant and seemingly floating. This patch not only relocates the check so it is more clearly associated with the invokation of mfd_add_devices(), but provides a store for the error value. We also print a meaningful message on error before returning.
Signed-off-by Laszlo Papp <[email protected]>
--- drivers/mfd/max8997.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mfd/max8997.c +5 -4
@@ -228,18 +228,19 @@ static int max8997_i2c_probe(struct i2c_client *i2c,max8997_irq_init (max8997); -mfd_add_devices (max8997->dev,-1 , max8997_devs, + ret =mfd_add_devices (max8997->dev,-1 , max8997_devs,ARRAY_SIZE (max8997_devs),NULL ,0 ,NULL ); +if (ret <0 ) { +dev_err (max8997->dev,"failed to add MFD devices %d\n" , ret); + goto err_mfd; + }/* * TODO: enable others (flash, muic, rtc, battery, ...) and * check the return value */ -if (ret <0 ) - goto err_mfd; -/* MAX8997 has a power button input. */ device_init_wakeup (max8997->dev, pdata->wakeup);
Signature · 1 line
1.8.5.1
Lee Jones
AppliedQuoted 10 lines · Laszlo Papp
The original author provided a random return value check which is redundant and seemingly floating. This patch not only relocates the check so it is more clearly associated with the invokation of
mfd_add_devices(), but provides a store for the error value. We also print a meaningful message on error before returning.Signed-off-by Laszlo Papp <[email protected]>--- drivers/mfd/max8997.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog