Skip to content

Commit

Permalink
pinctrl: ingenic: Fix group & function error checking
Browse files Browse the repository at this point in the history
Commit a203728 ("pinctrl: core: Return selector to the pinctrl
driver") and commit f913cfc ("pinctrl: pinmux: Return selector to
the pinctrl driver") modified the return values of
pinctrl_generic_add_group() and pinmux_generic_add_function()
respectively, but did so without updating their callers. This broke the
pinctrl-ingenic driver, which treats non-zero return values from these
functions as errors & fails to probe. For example on a MIPS Ci20:

  pinctrl-ingenic 10010000.pin-controller: Failed to register group uart0-hwflow
  pinctrl-ingenic: probe of 10010000.pin-controller failed with error 1

Without the pinctrl driver probed, other drivers go on to fail to probe
too & the system is unusable.

Fix this by modifying the error checks to treat only negative values as
errors, matching the commits that introduced the breakage & similar
changes made to other drivers.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: a203728 ("pinctrl: core: Return selector to the pinctrl driver")
Fixes: f913cfc ("pinctrl: pinmux: Return selector to the pinctrl driver")
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Tony Lindgren <tony@atomide.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
paulburton authored and linusw committed Aug 29, 2018
1 parent b55326d commit 823dd71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/pinctrl/pinctrl-ingenic.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ static int ingenic_pinctrl_probe(struct platform_device *pdev)

err = pinctrl_generic_add_group(jzpc->pctl, group->name,
group->pins, group->num_pins, group->data);
if (err) {
if (err < 0) {
dev_err(dev, "Failed to register group %s\n",
group->name);
return err;
Expand All @@ -806,7 +806,7 @@ static int ingenic_pinctrl_probe(struct platform_device *pdev)
err = pinmux_generic_add_function(jzpc->pctl, func->name,
func->group_names, func->num_group_names,
func->data);
if (err) {
if (err < 0) {
dev_err(dev, "Failed to register function %s\n",
func->name);
return err;
Expand Down

0 comments on commit 823dd71

Please sign in to comment.