gpio: adp5520: cleanup probe error path + remove platform_set_drvdata()

The platform_set_drvdata() call is only useful if we need to retrieve back
the private information.
Since the driver doesn't do that, it's not useful to have it.

This also means that the 'err' label can be removed and all goto statements
replaced with direct returns (with error codes).

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
Alexandru Ardelean 2021-05-14 11:56:27 +03:00 коммит произвёл Bartosz Golaszewski
Родитель ec5aa31bbe
Коммит 6681db5ef5
1 изменённых файлов: 4 добавлений и 14 удалений

Просмотреть файл

@ -113,10 +113,8 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
if (pdata->gpio_en_mask & (1 << i)) if (pdata->gpio_en_mask & (1 << i))
dev->lut[gpios++] = 1 << i; dev->lut[gpios++] = 1 << i;
if (gpios < 1) { if (gpios < 1)
ret = -EINVAL; return -EINVAL;
goto err;
}
gc = &dev->gpio_chip; gc = &dev->gpio_chip;
gc->direction_input = adp5520_gpio_direction_input; gc->direction_input = adp5520_gpio_direction_input;
@ -148,18 +146,10 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to write\n"); dev_err(&pdev->dev, "failed to write\n");
goto err; return ret;
} }
ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev); return devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev);
if (ret)
goto err;
platform_set_drvdata(pdev, dev);
return 0;
err:
return ret;
} }
static struct platform_driver adp5520_gpio_driver = { static struct platform_driver adp5520_gpio_driver = {