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

gpio: wm831x: 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
14ebdaec 96a03e86

+1 -11
+1 -11
drivers/gpio/gpio-wm831x.c
··· 261 261 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 262 262 struct wm831x_pdata *pdata = &wm831x->pdata; 263 263 struct wm831x_gpio *wm831x_gpio; 264 - int ret; 265 264 266 265 wm831x_gpio = devm_kzalloc(&pdev->dev, sizeof(*wm831x_gpio), 267 266 GFP_KERNEL); ··· 279 280 wm831x_gpio->gpio_chip.of_node = wm831x->dev->of_node; 280 281 #endif 281 282 282 - ret = devm_gpiochip_add_data(&pdev->dev, &wm831x_gpio->gpio_chip, 283 - wm831x_gpio); 284 - if (ret < 0) { 285 - dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); 286 - return ret; 287 - } 288 - 289 - platform_set_drvdata(pdev, wm831x_gpio); 290 - 291 - return ret; 283 + return devm_gpiochip_add_data(&pdev->dev, &wm831x_gpio->gpio_chip, wm831x_gpio); 292 284 } 293 285 294 286 static struct platform_driver wm831x_gpio_driver = {