Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexandru Ardelean and committed by
Bartosz Golaszewski
6681db5e ec5aa31b

+4 -14
+4 -14
drivers/gpio/gpio-adp5520.c
··· 113 113 if (pdata->gpio_en_mask & (1 << i)) 114 114 dev->lut[gpios++] = 1 << i; 115 115 116 - if (gpios < 1) { 117 - ret = -EINVAL; 118 - goto err; 119 - } 116 + if (gpios < 1) 117 + return -EINVAL; 120 118 121 119 gc = &dev->gpio_chip; 122 120 gc->direction_input = adp5520_gpio_direction_input; ··· 146 148 147 149 if (ret) { 148 150 dev_err(&pdev->dev, "failed to write\n"); 149 - goto err; 151 + return ret; 150 152 } 151 153 152 - ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev); 153 - if (ret) 154 - goto err; 155 - 156 - platform_set_drvdata(pdev, dev); 157 - return 0; 158 - 159 - err: 160 - return ret; 154 + return devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev); 161 155 } 162 156 163 157 static struct platform_driver adp5520_gpio_driver = {