net: rfkill: fixed "WARNING: invalid free of devm_ allocated data"

Change-Id: I3c84a08e9d62d6f16e4f162708584f7fd716066b
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
This commit is contained in:
xiaoyao 2016-02-26 15:25:12 +08:00 committed by Gerrit Code Review
parent 01e482c2d7
commit 68874647f2

View File

@ -573,10 +573,8 @@ static int rfkill_rk_probe(struct platform_device *pdev)
pdata->type = RFKILL_TYPE_BLUETOOTH;
rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
if (!rfkill) {
kfree(pdata);
if (!rfkill)
return -ENOMEM;
}
rfkill->pdata = pdata;
rfkill->pdev = pdev;
@ -705,7 +703,6 @@ static int rfkill_rk_remove(struct platform_device *pdev)
if (gpio_is_valid(rfkill->pdata->poweron_gpio.io))
gpio_free(rfkill->pdata->poweron_gpio.io);
kfree(rfkill);
g_rfkill = NULL;
return 0;