Commit 9081987d authored by Luis de Bethencourt's avatar Luis de Bethencourt Committed by Greg Kroah-Hartman

staging: wilc1000: return -ENOMEM when kmalloc failed

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:1757 Handle_Key() warn:
returning -1 instead of -ENOMEM is sloppy
Signed-off-by: default avatarLuis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent df8b4830
...@@ -1754,7 +1754,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1754,7 +1754,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
if (pu8keybuf == NULL) { if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send Key\n"); PRINT_ER("No buffer to send Key\n");
return -1; return -ENOMEM;
} }
kfree(pstrHostIFkeyAttr->attr.wep.key); kfree(pstrHostIFkeyAttr->attr.wep.key);
...@@ -1776,7 +1776,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1776,7 +1776,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL); pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL);
if (!pu8keybuf) { if (!pu8keybuf) {
PRINT_ER("No buffer to send Key\n"); PRINT_ER("No buffer to send Key\n");
return -1; return -ENOMEM;
} }
pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index; pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index;
memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->attr.wep.key_len, 1); memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->attr.wep.key_len, 1);
...@@ -1823,7 +1823,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1823,7 +1823,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (!pu8keybuf) { if (!pu8keybuf) {
PRINT_ER("No buffer to send RxGTK Key\n"); PRINT_ER("No buffer to send RxGTK Key\n");
ret = -1; ret = -ENOMEM;
goto _WPARxGtk_end_case_; goto _WPARxGtk_end_case_;
} }
...@@ -1858,7 +1858,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1858,7 +1858,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) { if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n"); PRINT_ER("No buffer to send RxGTK Key\n");
ret = -1; ret = -ENOMEM;
goto _WPARxGtk_end_case_; goto _WPARxGtk_end_case_;
} }
...@@ -1887,7 +1887,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1887,7 +1887,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
_WPARxGtk_end_case_: _WPARxGtk_end_case_:
kfree(pstrHostIFkeyAttr->attr.wpa.key); kfree(pstrHostIFkeyAttr->attr.wpa.key);
kfree(pstrHostIFkeyAttr->attr.wpa.seq); kfree(pstrHostIFkeyAttr->attr.wpa.seq);
if (ret == -1) if (ret)
return ret; return ret;
break; break;
...@@ -1899,7 +1899,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1899,7 +1899,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL);
if (!pu8keybuf) { if (!pu8keybuf) {
PRINT_ER("No buffer to send PTK Key\n"); PRINT_ER("No buffer to send PTK Key\n");
ret = -1; ret = -ENOMEM;
goto _WPAPtk_end_case_; goto _WPAPtk_end_case_;
} }
...@@ -1931,7 +1931,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1931,7 +1931,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
if (!pu8keybuf) { if (!pu8keybuf) {
PRINT_ER("No buffer to send PTK Key\n"); PRINT_ER("No buffer to send PTK Key\n");
ret = -1; ret = -ENOMEM;
goto _WPAPtk_end_case_; goto _WPAPtk_end_case_;
} }
...@@ -1954,7 +1954,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1954,7 +1954,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
_WPAPtk_end_case_: _WPAPtk_end_case_:
kfree(pstrHostIFkeyAttr->attr.wpa.key); kfree(pstrHostIFkeyAttr->attr.wpa.key);
if (ret == -1) if (ret)
return ret; return ret;
break; break;
...@@ -1967,7 +1967,7 @@ static int Handle_Key(struct host_if_drv *hif_drv, ...@@ -1967,7 +1967,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL);
if (!pu8keybuf) { if (!pu8keybuf) {
PRINT_ER("No buffer to send PMKSA Key\n"); PRINT_ER("No buffer to send PMKSA Key\n");
return -1; return -ENOMEM;
} }
pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid; pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment