Commit 141bc9ab authored by Wang Hai's avatar Wang Hai Committed by Kalle Valo
Browse files

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: 616f5701 ("qtnfmac: assign each wiphy to its own virtual platform device")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWang Hai <wanghai38@huawei.com>
Reviewed-by: default avatarSergey Matyukevich <geomatsi@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200730064910.37589-1-wanghai38@huawei.com
parent e52525c0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);