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>
This commit is contained in:
parent
5495d1636b
commit
21793d228c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user