diff options
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r-- | drivers/pinctrl/core.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index b01ee7281130..804d126b7065 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1706,14 +1706,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, int ret; if (!pctldesc) - return NULL; + return ERR_PTR(-EINVAL); if (!pctldesc->name) - return NULL; + return ERR_PTR(-EINVAL); pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL); if (pctldev == NULL) { dev_err(dev, "failed to alloc struct pinctrl_dev\n"); - return NULL; + return ERR_PTR(-ENOMEM); } /* Initialize pin control device struct */ @@ -1726,20 +1726,23 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, mutex_init(&pctldev->mutex); /* check core ops for sanity */ - if (pinctrl_check_ops(pctldev)) { + ret = pinctrl_check_ops(pctldev); + if (ret) { dev_err(dev, "pinctrl ops lacks necessary functions\n"); goto out_err; } /* If we're implementing pinmuxing, check the ops for sanity */ if (pctldesc->pmxops) { - if (pinmux_check_ops(pctldev)) + ret = pinmux_check_ops(pctldev); + if (ret) goto out_err; } /* If we're implementing pinconfig, check the ops for sanity */ if (pctldesc->confops) { - if (pinconf_check_ops(pctldev)) + ret = pinconf_check_ops(pctldev); + if (ret) goto out_err; } @@ -1785,7 +1788,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, out_err: mutex_destroy(&pctldev->mutex); kfree(pctldev); - return NULL; + return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(pinctrl_register); |