When assigning directly to the pointer contained in the driver data the local variable can be dropped together with the extra assignment to it. The downside is that davem doesn't like writing error pointers to dynamically allocated memory as this might result in bugs like: if (driverdata->gpio) free_resources(driverdata->gpio); which is probably wrong for error values. In this case however there is no cleanup code for the gpios as everything is managed by devm_* and furthermore already without this change there is an error path further down in rfkill_gpio_probe that potentially keeps a valid gpio descriptor in driver data which must not be used. For this eventually calling some cleanup function is hardly better than on an error pointer. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> --- net/rfkill/rfkill-gpio.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index d5d58d919552..fd540024c506 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -92,7 +92,6 @@ static int rfkill_gpio_probe(struct platform_device *pdev) { struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; struct rfkill_gpio_data *rfkill; - struct gpio_desc *gpio; int ret; rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); @@ -112,17 +111,15 @@ static int rfkill_gpio_probe(struct platform_device *pdev) rfkill->clk = devm_clk_get(&pdev->dev, NULL); - gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(gpio)) - return PTR_ERR(gpio); + rfkill->reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(rfkill->reset_gpio)) + return PTR_ERR(rfkill->reset_gpio); - rfkill->reset_gpio = gpio; - - gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", GPIOD_OUT_LOW); - if (IS_ERR(gpio)) - return PTR_ERR(gpio); - - rfkill->shutdown_gpio = gpio; + rfkill->shutdown_gpio = devm_gpiod_get_optional(&pdev->dev, "shutdown", + GPIOD_OUT_LOW); + if (IS_ERR(rfkill->shutdown_gpio)) + return PTR_ERR(rfkill->shutdown_gpio); /* Make sure at-least one of the GPIO is defined and that * a name is specified for this instance -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html