Skip to content

Commit

Permalink
net: rfkill: gpio: Switch to devm_acpi_dev_add_driver_gpios()
Browse files Browse the repository at this point in the history
Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify
error path and fix potentially wrong assingment if ->probe() fails.

Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
andy-shev authored and jmberg-intel committed Jun 13, 2017
1 parent 6dad28a commit 4524667
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions net/rfkill/rfkill-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ static int rfkill_gpio_acpi_probe(struct device *dev,

rfkill->type = (unsigned)id->driver_data;

return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
acpi_rfkill_default_gpios);
return devm_acpi_dev_add_driver_gpios(dev, acpi_rfkill_default_gpios);
}

static int rfkill_gpio_probe(struct platform_device *pdev)
Expand Down Expand Up @@ -154,8 +153,6 @@ static int rfkill_gpio_remove(struct platform_device *pdev)
rfkill_unregister(rfkill->rfkill_dev);
rfkill_destroy(rfkill->rfkill_dev);

acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));

return 0;
}

Expand Down

0 comments on commit 4524667

Please sign in to comment.