From: xiaoyao Date: Fri, 26 Feb 2016 07:25:12 +0000 (+0800) Subject: net: rfkill: fixed "WARNING: invalid free of devm_ allocated data" X-Git-Tag: firefly_0821_release~3352 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=68874647f25d3984d538ca736d43084a7e0f40e2;p=firefly-linux-kernel-4.4.55.git net: rfkill: fixed "WARNING: invalid free of devm_ allocated data" Change-Id: I3c84a08e9d62d6f16e4f162708584f7fd716066b Signed-off-by: xiaoyao --- diff --git a/net/rfkill/rfkill-bt.c b/net/rfkill/rfkill-bt.c index a1a156c22efd..3df55f92d07c 100755 --- a/net/rfkill/rfkill-bt.c +++ b/net/rfkill/rfkill-bt.c @@ -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;