Commit 4bf01ca2 authored by Johan Hovold's avatar Johan Hovold Committed by Johannes Berg

rfkill: gpio: fix memory leak in probe error path

Make sure to free the rfkill device in case registration fails during

Fixes: 5e7ca393 ("net: rfkill: gpio: convert to resource managed allocation")
Cc: stable <>	# 3.13
Cc: Heikki Krogerus <>
Signed-off-by: default avatarJohan Hovold <>
Reviewed-by: default avatarHeikki Krogerus <>
Signed-off-by: default avatarJohannes Berg <>
parent e8f90c74
......@@ -137,13 +137,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;
return ret;
static int rfkill_gpio_remove(struct platform_device *pdev)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment