Commit ebc25991 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

pinctrl: mcp23s08: Improve error messaging in ->probe()

Print particular message in each of error case in the ->probe().
While here, use dev_err_probe() for that.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200828103235.78380-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent d32f38f2
...@@ -564,7 +564,7 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, ...@@ -564,7 +564,7 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
ret = mcp_read(mcp, MCP_IOCON, &status); ret = mcp_read(mcp, MCP_IOCON, &status);
if (ret < 0) if (ret < 0)
goto fail; return dev_err_probe(dev, ret, "can't identify chip %d\n", addr);
mcp->irq_controller = mcp->irq_controller =
device_property_read_bool(dev, "interrupt-controller"); device_property_read_bool(dev, "interrupt-controller");
...@@ -598,7 +598,7 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, ...@@ -598,7 +598,7 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
ret = mcp_write(mcp, MCP_IOCON, status); ret = mcp_write(mcp, MCP_IOCON, status);
if (ret < 0) if (ret < 0)
goto fail; return dev_err_probe(dev, ret, "can't write IOCON %d\n", addr);
} }
if (mcp->irq && mcp->irq_controller) { if (mcp->irq && mcp->irq_controller) {
...@@ -616,7 +616,7 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, ...@@ -616,7 +616,7 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp); ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
if (ret < 0) if (ret < 0)
goto fail; return dev_err_probe(dev, ret, "can't add GPIO chip\n");
mcp->pinctrl_desc.pctlops = &mcp_pinctrl_ops; mcp->pinctrl_desc.pctlops = &mcp_pinctrl_ops;
mcp->pinctrl_desc.confops = &mcp_pinconf_ops; mcp->pinctrl_desc.confops = &mcp_pinconf_ops;
...@@ -628,18 +628,17 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, ...@@ -628,18 +628,17 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
mcp->pinctrl_desc.owner = THIS_MODULE; mcp->pinctrl_desc.owner = THIS_MODULE;
mcp->pctldev = devm_pinctrl_register(dev, &mcp->pinctrl_desc, mcp); mcp->pctldev = devm_pinctrl_register(dev, &mcp->pinctrl_desc, mcp);
if (IS_ERR(mcp->pctldev)) { if (IS_ERR(mcp->pctldev))
ret = PTR_ERR(mcp->pctldev); return dev_err_probe(dev, PTR_ERR(mcp->pctldev), "can't register controller\n");
goto fail;
}
if (mcp->irq) if (mcp->irq) {
ret = mcp23s08_irq_setup(mcp); ret = mcp23s08_irq_setup(mcp);
if (ret)
return dev_err_probe(dev, ret, "can't setup IRQ\n");
}
fail: return 0;
if (ret < 0)
dev_dbg(dev, "can't setup chip %d, --> %d\n", addr, ret);
return ret;
} }
EXPORT_SYMBOL_GPL(mcp23s08_probe_one); EXPORT_SYMBOL_GPL(mcp23s08_probe_one);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
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