Skip to content

Commit

Permalink
pinctrl: amd: Use devm_platform_get_and_ioremap_resource
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Basavaraj Natikar authored and Linus Walleij committed Jul 9, 2022
1 parent 5495d16 commit 21793d2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/pinctrl/pinctrl-amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 21793d2

Please sign in to comment.