brcmsmac: mac80211_if: Fix a resource leak in an error handling path
[ Upstream commit9a25344d51
] If 'brcms_attach()' fails, we must undo the previous 'ieee80211_alloc_hw()' as already done in the remove function. Fixes:5b435de0d7
("net: wireless: add brcm80211 drivers") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/8fbc171a1a493b38db5a6f0873c6021fca026a6c.1620852921.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5d452eafbd
commit
30efdcaca3
@ -1221,6 +1221,7 @@ static int brcms_bcma_probe(struct bcma_device *pdev)
|
|||||||
{
|
{
|
||||||
struct brcms_info *wl;
|
struct brcms_info *wl;
|
||||||
struct ieee80211_hw *hw;
|
struct ieee80211_hw *hw;
|
||||||
|
int ret;
|
||||||
|
|
||||||
dev_info(&pdev->dev, "mfg %x core %x rev %d class %d irq %d\n",
|
dev_info(&pdev->dev, "mfg %x core %x rev %d class %d irq %d\n",
|
||||||
pdev->id.manuf, pdev->id.id, pdev->id.rev, pdev->id.class,
|
pdev->id.manuf, pdev->id.id, pdev->id.rev, pdev->id.class,
|
||||||
@ -1245,11 +1246,16 @@ static int brcms_bcma_probe(struct bcma_device *pdev)
|
|||||||
wl = brcms_attach(pdev);
|
wl = brcms_attach(pdev);
|
||||||
if (!wl) {
|
if (!wl) {
|
||||||
pr_err("%s: brcms_attach failed!\n", __func__);
|
pr_err("%s: brcms_attach failed!\n", __func__);
|
||||||
return -ENODEV;
|
ret = -ENODEV;
|
||||||
|
goto err_free_ieee80211;
|
||||||
}
|
}
|
||||||
brcms_led_register(wl);
|
brcms_led_register(wl);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_free_ieee80211:
|
||||||
|
ieee80211_free_hw(hw);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int brcms_suspend(struct bcma_device *pdev)
|
static int brcms_suspend(struct bcma_device *pdev)
|
||||||
|
Reference in New Issue
Block a user