* [PATCH] staging: wilc1000: return -ENOMEM when kmalloc failed
@ 2015-10-21 23:07 Luis de Bethencourt
2015-10-25 1:21 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Luis de Bethencourt @ 2015-10-21 23:07 UTC (permalink / raw)
To: linux-kernel
Cc: johnny.kim, rachel.kim, chris.park, tony.cho, glen.lee, leo.kim,
gregkh, linux-wireless, devel, Luis de Bethencourt
The driver is using -1 instead of the -ENOMEM defined macro to specify that
a buffer allocation failed.
Fixes smatch warning and similars:
drivers/staging/wilc1000/host_interface.c:1782 Handle_Key() warn:
returning -1 instead of -ENOMEM is sloppy
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---
drivers/staging/wilc1000/host_interface.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 38fead4..ec47a28 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1756,7 +1756,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send Key\n");
- return -1;
+ return -ENOMEM;
}
kfree(pstrHostIFkeyAttr->attr.wep.key);
@@ -1779,7 +1779,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send Key\n");
- return -1;
+ return -ENOMEM;
}
pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index;
memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->attr.wep.key_len, 1);
@@ -1826,7 +1826,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n");
- ret = -1;
+ ret = -ENOMEM;
goto _WPARxGtk_end_case_;
}
@@ -1861,7 +1861,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n");
- ret = -1;
+ ret = -ENOMEM;
goto _WPARxGtk_end_case_;
}
@@ -1890,7 +1890,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
_WPARxGtk_end_case_:
kfree(pstrHostIFkeyAttr->attr.wpa.key);
kfree(pstrHostIFkeyAttr->attr.wpa.seq);
- if (ret == -1)
+ if (ret)
return ret;
break;
@@ -1905,7 +1905,7 @@ _WPARxGtk_end_case_:
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PTK Key\n");
- ret = -1;
+ ret = -ENOMEM;
goto _WPAPtk_end_case_;
}
@@ -1940,7 +1940,7 @@ _WPARxGtk_end_case_:
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PTK Key\n");
- ret = -1;
+ ret = -ENOMEM;
goto _WPAPtk_end_case_;
}
@@ -1963,7 +1963,7 @@ _WPARxGtk_end_case_:
_WPAPtk_end_case_:
kfree(pstrHostIFkeyAttr->attr.wpa.key);
- if (ret == -1)
+ if (ret)
return ret;
break;
@@ -1976,7 +1976,7 @@ _WPAPtk_end_case_:
pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PMKSA Key\n");
- return -1;
+ return -ENOMEM;
}
pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid;
--
2.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: wilc1000: return -ENOMEM when kmalloc failed
2015-10-21 23:07 [PATCH] staging: wilc1000: return -ENOMEM when kmalloc failed Luis de Bethencourt
@ 2015-10-25 1:21 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-10-25 1:21 UTC (permalink / raw)
To: Luis de Bethencourt
Cc: linux-kernel, johnny.kim, rachel.kim, chris.park, tony.cho,
glen.lee, leo.kim, linux-wireless, devel
On Thu, Oct 22, 2015 at 12:07:36AM +0100, Luis de Bethencourt wrote:
> The driver is using -1 instead of the -ENOMEM defined macro to specify that
> a buffer allocation failed.
>
> Fixes smatch warning and similars:
> drivers/staging/wilc1000/host_interface.c:1782 Handle_Key() warn:
> returning -1 instead of -ENOMEM is sloppy
>
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
> drivers/staging/wilc1000/host_interface.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
Doesn't apply against my tree anymore, can you refresh this against the
staging-testing branch of staging.git and resend?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-25 8:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-21 23:07 [PATCH] staging: wilc1000: return -ENOMEM when kmalloc failed Luis de Bethencourt
2015-10-25 1:21 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).