mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 23:36:23 +09:00
rfkill: gpio: fix memory leak in probe error path
commit4bf01ca21e
upstream. Make sure to free the rfkill device in case registration fails during probe. Fixes:5e7ca3937f
("net: rfkill: gpio: convert to resource managed allocation") Cc: stable <stable@vger.kernel.org> # 3.13 Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a8c459de16
commit
6a08f48efa
|
@ -140,13 +140,18 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
|
|||
|
||||
ret = rfkill_register(rfkill->rfkill_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto err_destroy;
|
||||
|
||||
platform_set_drvdata(pdev, rfkill);
|
||||
|
||||
dev_info(&pdev->dev, "%s device registered.\n", rfkill->name);
|
||||
|
||||
return 0;
|
||||
|
||||
err_destroy:
|
||||
rfkill_destroy(rfkill->rfkill_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rfkill_gpio_remove(struct platform_device *pdev)
|
||||
|
|
Loading…
Reference in New Issue
Block a user