From: Wang Hai Date: Thu, 30 Jul 2020 06:49:10 +0000 (+0800) Subject: qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc() X-Git-Tag: v5.15~3197^2~19^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=141bc9abbbffa89d020957caa9ac4a61d0ef1e26;p=platform%2Fkernel%2Flinux-starfive.git qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc() Add the missing platform_device_unregister() before return from qtnf_core_mac_alloc() in the error handling case. Fixes: 616f5701f4ab ("qtnfmac: assign each wiphy to its own virtual platform device") Reported-by: Hulk Robot Signed-off-by: Wang Hai Reviewed-by: Sergey Matyukevich Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200730064910.37589-1-wanghai38@huawei.com --- diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index eea777f..6aafff9 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -446,8 +446,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus, } wiphy = qtnf_wiphy_allocate(bus, pdev); - if (!wiphy) + if (!wiphy) { + if (pdev) + platform_device_unregister(pdev); return ERR_PTR(-ENOMEM); + } mac = wiphy_priv(wiphy);