net: rfkill: fixed "WARNING: invalid free of devm_ allocated data"
authorxiaoyao <xiaoyao@rock-chips.com>
Fri, 26 Feb 2016 07:25:12 +0000 (15:25 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Fri, 26 Feb 2016 08:29:29 +0000 (16:29 +0800)
Change-Id: I3c84a08e9d62d6f16e4f162708584f7fd716066b
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
net/rfkill/rfkill-bt.c

index a1a156c22efdabd1777a410f6ca9f7daafda0df5..3df55f92d07c25616936d4de3f6e2bc9b7a15552 100755 (executable)
@@ -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;