* [PATCH 1/2] staging: ks7010: return on failure
@ 2016-08-23 18:37 Sudip Mukherjee
2016-08-23 18:37 ` [PATCH 2/2] staging: ks7010: fix memory leak Sudip Mukherjee
2016-09-01 15:53 ` [PATCH 1/2] staging: ks7010: return on failure Greg Kroah-Hartman
0 siblings, 2 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2016-08-23 18:37 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, devel, Sudip Mukherjee
On failure we were jumping to error_out0 where we were trying
sdio_release_host() but at this point of execution we still have not
done sdio_claim_host() and as a result host->claimed can still be 0.
And if host->claimed is 0 then WARN_ON(!host->claimed) will give
a warning.
Moreover, if it is still not claimed then mmc_host->claim_cnt will be 0
and mmc_release_host() will do "if (--host->claim_cnt)" and thus the
condition will become true.
Lets just return the value on allocation failure instead of trying to
release the host before claiming it.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
drivers/staging/ks7010/ks7010_sdio.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 47b69cb..7bcf1ea 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -776,10 +776,8 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
/* buffer allocate */
rom_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
- if (!rom_buf) {
- rc = 3;
- goto error_out0;
- }
+ if (!rom_buf)
+ return 3;
sdio_claim_host(card->func);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] staging: ks7010: fix memory leak
2016-08-23 18:37 [PATCH 1/2] staging: ks7010: return on failure Sudip Mukherjee
@ 2016-08-23 18:37 ` Sudip Mukherjee
2016-09-01 15:53 ` [PATCH 1/2] staging: ks7010: return on failure Greg Kroah-Hartman
1 sibling, 0 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2016-08-23 18:37 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, devel, Sudip Mukherjee
If the firmware request failed we were just returning but we missed
freeing the memory and releasing the MMC Host.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
drivers/staging/ks7010/ks7010_sdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 7bcf1ea..86cdebe 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -791,7 +791,7 @@ static int ks7010_upload_firmware(struct ks_wlan_private *priv,
retval = request_firmware(&fw_entry, ROM_FILE, &priv->ks_wlan_hw.sdio_card->func->dev);
if (retval)
- return retval;
+ goto error_out0;
length = fw_entry->size;
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] staging: ks7010: return on failure
2016-08-23 18:37 [PATCH 1/2] staging: ks7010: return on failure Sudip Mukherjee
2016-08-23 18:37 ` [PATCH 2/2] staging: ks7010: fix memory leak Sudip Mukherjee
@ 2016-09-01 15:53 ` Greg Kroah-Hartman
1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2016-09-01 15:53 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: devel, linux-kernel
On Wed, Aug 24, 2016 at 12:07:35AM +0530, Sudip Mukherjee wrote:
> On failure we were jumping to error_out0 where we were trying
> sdio_release_host() but at this point of execution we still have not
> done sdio_claim_host() and as a result host->claimed can still be 0.
> And if host->claimed is 0 then WARN_ON(!host->claimed) will give
> a warning.
> Moreover, if it is still not claimed then mmc_host->claim_cnt will be 0
> and mmc_release_host() will do "if (--host->claim_cnt)" and thus the
> condition will become true.
> Lets just return the value on allocation failure instead of trying to
> release the host before claiming it.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
> drivers/staging/ks7010/ks7010_sdio.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Please always cc: the maintainer of the driver when you send patches in.
Please fix that up and resend these 2 patches.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-01 15:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23 18:37 [PATCH 1/2] staging: ks7010: return on failure Sudip Mukherjee
2016-08-23 18:37 ` [PATCH 2/2] staging: ks7010: fix memory leak Sudip Mukherjee
2016-09-01 15:53 ` [PATCH 1/2] staging: ks7010: return on failure Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.