Commit 75d8a2b0 authored by Charles Keepax's avatar Charles Keepax Committed by Lee Jones

mfd: arizona: Add sensible return value to some error paths

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: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent c695abab
...@@ -1061,7 +1061,7 @@ int arizona_dev_init(struct arizona *arizona) ...@@ -1061,7 +1061,7 @@ int arizona_dev_init(struct arizona *arizona)
default: default:
dev_err(arizona->dev, "Unknown device type %d\n", dev_err(arizona->dev, "Unknown device type %d\n",
arizona->type); arizona->type);
return -EINVAL; return -ENODEV;
} }
/* Mark DCVDD as external, LDO1 driver will clear if internal */ /* Mark DCVDD as external, LDO1 driver will clear if internal */
...@@ -1147,6 +1147,7 @@ int arizona_dev_init(struct arizona *arizona) ...@@ -1147,6 +1147,7 @@ int arizona_dev_init(struct arizona *arizona)
break; break;
default: default:
dev_err(arizona->dev, "Unknown device ID: %x\n", reg); dev_err(arizona->dev, "Unknown device ID: %x\n", reg);
ret = -ENODEV;
goto err_reset; goto err_reset;
} }
...@@ -1306,12 +1307,14 @@ int arizona_dev_init(struct arizona *arizona) ...@@ -1306,12 +1307,14 @@ int arizona_dev_init(struct arizona *arizona)
break; break;
default: default:
dev_err(arizona->dev, "Unknown device ID %x\n", reg); dev_err(arizona->dev, "Unknown device ID %x\n", reg);
ret = -ENODEV;
goto err_reset; goto err_reset;
} }
if (!subdevs) { if (!subdevs) {
dev_err(arizona->dev, dev_err(arizona->dev,
"No kernel support for device ID %x\n", reg); "No kernel support for device ID %x\n", reg);
ret = -ENODEV;
goto err_reset; goto err_reset;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment