diff options
author | Basavaraj Natikar <Basavaraj.Natikar@amd.com> | 2022-06-13 12:11:25 +0530 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2022-07-10 01:09:21 +0200 |
commit | 21793d228ca2caefa8b93a0fc8e92815a46b1a43 (patch) | |
tree | 1a2166badf9c865aad4adcfece148db2511e6a98 /drivers/pinctrl | |
parent | 5495d1636b93ad9e5471f74a94487964c99f8b08 (diff) |
pinctrl: amd: Use devm_platform_get_and_ioremap_resource
Use devm_platform_get_and_ioremap_resource() to simplify code.
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Link: https://lore.kernel.org/r/20220613064127.220416-2-Basavaraj.Natikar@amd.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-amd.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c index ed52ea6a1ed8..e497df89a4a7 100644 --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -1079,17 +1079,12 @@ static int amd_gpio_probe(struct platform_device *pdev) raw_spin_lock_init(&gpio_dev->lock); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { + gpio_dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(gpio_dev->base)) { dev_err(&pdev->dev, "Failed to get gpio io resource.\n"); - return -EINVAL; + return PTR_ERR(gpio_dev->base); } - gpio_dev->base = devm_ioremap(&pdev->dev, res->start, - resource_size(res)); - if (!gpio_dev->base) - return -ENOMEM; - gpio_dev->irq = platform_get_irq(pdev, 0); if (gpio_dev->irq < 0) return gpio_dev->irq; |