regulator: da9063: Return an error code on probe failure
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 30 Aug 2017 14:03:58 +0000 (17:03 +0300)
committerMark Brown <broonie@kernel.org>
Wed, 30 Aug 2017 15:05:46 +0000 (16:05 +0100)
If "regl_pdata->n_regulators == 0" is true then we accidentally return
PTR_ERR(<some_valid_pointer>) instead of an error code.  I've changed it
to return -ENODEV instead.

Fixes: 69ca3e58d178 ("regulator: da9063: Add Dialog DA9063 voltage regulators support.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/da9063-regulator.c

index c6af343f54eac5c59b3e06923e3b4141413b833e..6a8f9cd69f520f8ff188c267a774b7c8af7ea64a 100644 (file)
@@ -736,7 +736,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
        if (IS_ERR(regl_pdata) || regl_pdata->n_regulators == 0) {
                dev_err(&pdev->dev,
                        "No regulators defined for the platform\n");
-               return PTR_ERR(regl_pdata);
+               return -ENODEV;
        }
 
        /* Find regulators set for particular device model */