mfd: arizona: Add sensible return value to some error paths
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Wed, 31 Aug 2016 09:41:30 +0000 (10:41 +0100)
committerLee Jones <lee.jones@linaro.org>
Mon, 12 Sep 2016 08:56:16 +0000 (09:56 +0100)
There are some cases in arizona_dev_init, such as where we don't
recognise the chip ID, in which we head to the error path without
setting a sensible error code in ret. This would lead to the chip
silently failing probe, as it would still return 0. Fix this up by
adding appropriate sets of the return value.

Whilst adding these update the existing paths that do return an error
when the chip is not recognised to use ENODEV, which seems like a better
fit.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/arizona-core.c

index e4f97b3c824bf1dbb414d844f7008d00acdf119c..cdbb8a22b3f9c8997bc10a8e34bacbd8bf389765 100644 (file)
@@ -1035,7 +1035,7 @@ int arizona_dev_init(struct arizona *arizona)
        default:
                dev_err(arizona->dev, "Unknown device type %d\n",
                        arizona->type);
-               return -EINVAL;
+               return -ENODEV;
        }
 
        /* Mark DCVDD as external, LDO1 driver will clear if internal */
@@ -1121,6 +1121,7 @@ int arizona_dev_init(struct arizona *arizona)
                break;
        default:
                dev_err(arizona->dev, "Unknown device ID: %x\n", reg);
+               ret = -ENODEV;
                goto err_reset;
        }
 
@@ -1280,12 +1281,14 @@ int arizona_dev_init(struct arizona *arizona)
                break;
        default:
                dev_err(arizona->dev, "Unknown device ID %x\n", reg);
+               ret = -ENODEV;
                goto err_reset;
        }
 
        if (!subdevs) {
                dev_err(arizona->dev,
                        "No kernel support for device ID %x\n", reg);
+               ret = -ENODEV;
                goto err_reset;
        }
 
This page took 0.025338 seconds and 5 git commands to generate.