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

gpio: altera-a10sr: remove platform_set_drvdata() + cleanup probe

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.

If this is removed, we can also just do a direct return on
devm_gpiochip_add_data(). We don't need to print that this call failed as
there are other ways to log/see this during probe.

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
aa93b0f3 6681db5e

+1 -10
+1 -10
drivers/gpio/gpio-altera-a10sr.c
··· 78 78 static int altr_a10sr_gpio_probe(struct platform_device *pdev) 79 79 { 80 80 struct altr_a10sr_gpio *gpio; 81 - int ret; 82 81 struct altr_a10sr *a10sr = dev_get_drvdata(pdev->dev.parent); 83 82 84 83 gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); ··· 90 91 gpio->gp.parent = pdev->dev.parent; 91 92 gpio->gp.of_node = pdev->dev.of_node; 92 93 93 - ret = devm_gpiochip_add_data(&pdev->dev, &gpio->gp, gpio); 94 - if (ret < 0) { 95 - dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); 96 - return ret; 97 - } 98 - 99 - platform_set_drvdata(pdev, gpio); 100 - 101 - return 0; 94 + return devm_gpiochip_add_data(&pdev->dev, &gpio->gp, gpio); 102 95 } 103 96 104 97 static const struct of_device_id altr_a10sr_gpio_of_match[] = {