From: Dan Carpenter Date: Tue, 4 Aug 2015 07:49:27 +0000 (+0300) Subject: mwifiex: usb: return an error if kmalloc fails X-Git-Tag: firefly_0821_release~176^2~1159^2~124^2~16 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3b1f0e86958b8afcfb6980f987c41e149480f9bd;p=firefly-linux-kernel-4.4.55.git mwifiex: usb: return an error if kmalloc fails The current code returns success if kmalloc fails. Signed-off-by: Dan Carpenter Acked-by: Amitkumar Karwar Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index fbad99c50307..f866d5da222b 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c @@ -870,8 +870,10 @@ static int mwifiex_prog_fw_w_helper(struct mwifiex_adapter *adapter, /* Allocate memory for transmit */ fwdata = kzalloc(FW_DNLD_TX_BUF_SIZE, GFP_KERNEL); - if (!fwdata) + if (!fwdata) { + ret = -ENOMEM; goto fw_exit; + } /* Allocate memory for receive */ recv_buff = kzalloc(FW_DNLD_RX_BUF_SIZE, GFP_KERNEL);