diff options
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r-- | drivers/pinctrl/core.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 18ee2089df4a..8b8f3a04c353 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -558,7 +558,7 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev, | |||
558 | } | 558 | } |
559 | 559 | ||
560 | /** | 560 | /** |
561 | * pinctrl_request_gpio() - request a single pin to be used in as GPIO | 561 | * pinctrl_request_gpio() - request a single pin to be used as GPIO |
562 | * @gpio: the GPIO pin number from the GPIO subsystem number space | 562 | * @gpio: the GPIO pin number from the GPIO subsystem number space |
563 | * | 563 | * |
564 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, | 564 | * This function should *ONLY* be used from gpiolib-based GPIO drivers, |
@@ -1115,7 +1115,7 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps, | |||
1115 | int i, ret; | 1115 | int i, ret; |
1116 | struct pinctrl_maps *maps_node; | 1116 | struct pinctrl_maps *maps_node; |
1117 | 1117 | ||
1118 | pr_debug("add %d pinmux maps\n", num_maps); | 1118 | pr_debug("add %u pinctrl maps\n", num_maps); |
1119 | 1119 | ||
1120 | /* First sanity check the new mapping */ | 1120 | /* First sanity check the new mapping */ |
1121 | for (i = 0; i < num_maps; i++) { | 1121 | for (i = 0; i < num_maps; i++) { |
@@ -1704,14 +1704,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
1704 | int ret; | 1704 | int ret; |
1705 | 1705 | ||
1706 | if (!pctldesc) | 1706 | if (!pctldesc) |
1707 | return NULL; | 1707 | return ERR_PTR(-EINVAL); |
1708 | if (!pctldesc->name) | 1708 | if (!pctldesc->name) |
1709 | return NULL; | 1709 | return ERR_PTR(-EINVAL); |
1710 | 1710 | ||
1711 | pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL); | 1711 | pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL); |
1712 | if (pctldev == NULL) { | 1712 | if (pctldev == NULL) { |
1713 | dev_err(dev, "failed to alloc struct pinctrl_dev\n"); | 1713 | dev_err(dev, "failed to alloc struct pinctrl_dev\n"); |
1714 | return NULL; | 1714 | return ERR_PTR(-ENOMEM); |
1715 | } | 1715 | } |
1716 | 1716 | ||
1717 | /* Initialize pin control device struct */ | 1717 | /* Initialize pin control device struct */ |
@@ -1724,20 +1724,23 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
1724 | mutex_init(&pctldev->mutex); | 1724 | mutex_init(&pctldev->mutex); |
1725 | 1725 | ||
1726 | /* check core ops for sanity */ | 1726 | /* check core ops for sanity */ |
1727 | if (pinctrl_check_ops(pctldev)) { | 1727 | ret = pinctrl_check_ops(pctldev); |
1728 | if (ret) { | ||
1728 | dev_err(dev, "pinctrl ops lacks necessary functions\n"); | 1729 | dev_err(dev, "pinctrl ops lacks necessary functions\n"); |
1729 | goto out_err; | 1730 | goto out_err; |
1730 | } | 1731 | } |
1731 | 1732 | ||
1732 | /* If we're implementing pinmuxing, check the ops for sanity */ | 1733 | /* If we're implementing pinmuxing, check the ops for sanity */ |
1733 | if (pctldesc->pmxops) { | 1734 | if (pctldesc->pmxops) { |
1734 | if (pinmux_check_ops(pctldev)) | 1735 | ret = pinmux_check_ops(pctldev); |
1736 | if (ret) | ||
1735 | goto out_err; | 1737 | goto out_err; |
1736 | } | 1738 | } |
1737 | 1739 | ||
1738 | /* If we're implementing pinconfig, check the ops for sanity */ | 1740 | /* If we're implementing pinconfig, check the ops for sanity */ |
1739 | if (pctldesc->confops) { | 1741 | if (pctldesc->confops) { |
1740 | if (pinconf_check_ops(pctldev)) | 1742 | ret = pinconf_check_ops(pctldev); |
1743 | if (ret) | ||
1741 | goto out_err; | 1744 | goto out_err; |
1742 | } | 1745 | } |
1743 | 1746 | ||
@@ -1783,7 +1786,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
1783 | out_err: | 1786 | out_err: |
1784 | mutex_destroy(&pctldev->mutex); | 1787 | mutex_destroy(&pctldev->mutex); |
1785 | kfree(pctldev); | 1788 | kfree(pctldev); |
1786 | return NULL; | 1789 | return ERR_PTR(ret); |
1787 | } | 1790 | } |
1788 | EXPORT_SYMBOL_GPL(pinctrl_register); | 1791 | EXPORT_SYMBOL_GPL(pinctrl_register); |
1789 | 1792 | ||