diff options
author | Dinghao Liu <dinghao.liu@zju.edu.cn> | 2020-08-20 08:48:19 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2020-08-27 13:01:31 +0300 |
commit | 8d95ab34b21ee0f870a9185b6457e8f6eb54914c (patch) | |
tree | 4e687ae75fa5ca1def00b90234f7f9376c6fa1f3 | |
parent | 621a3a8b1c0ecf16e1e5667ea5756a76a082b738 (diff) | |
download | linux-8d95ab34b21ee0f870a9185b6457e8f6eb54914c.tar.xz |
wilc1000: Fix memleak in wilc_sdio_probe
When devm_clk_get() returns -EPROBE_DEFER, sdio_priv
should be freed just like when wilc_cfg80211_init()
fails.
Fixes: 8692b047e86cf ("staging: wilc1000: look for rtc_clk clock")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200820054819.23365-1-dinghao.liu@zju.edu.cn
-rw-r--r-- | drivers/net/wireless/microchip/wilc1000/sdio.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c index 3ece7b0b0392..351ff909ab1c 100644 --- a/drivers/net/wireless/microchip/wilc1000/sdio.c +++ b/drivers/net/wireless/microchip/wilc1000/sdio.c @@ -149,9 +149,10 @@ static int wilc_sdio_probe(struct sdio_func *func, wilc->dev = &func->dev; wilc->rtc_clk = devm_clk_get(&func->card->dev, "rtc"); - if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER) + if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER) { + kfree(sdio_priv); return -EPROBE_DEFER; - else if (!IS_ERR(wilc->rtc_clk)) + } else if (!IS_ERR(wilc->rtc_clk)) clk_prepare_enable(wilc->rtc_clk); dev_info(&func->dev, "Driver Initializing success\n"); |