From patchwork Tue Aug 22 08:11:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 9914481 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34D31600C5 for ; Tue, 22 Aug 2017 08:12:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 415D9287EC for ; Tue, 22 Aug 2017 08:12:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3645728820; Tue, 22 Aug 2017 08:12:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_HI, RCVD_IN_SBL_CSS, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB0A2287EC for ; Tue, 22 Aug 2017 08:12:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932502AbdHVILo (ORCPT ); Tue, 22 Aug 2017 04:11:44 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35038 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932468AbdHVILl (ORCPT ); Tue, 22 Aug 2017 04:11:41 -0400 Received: by mail-pf0-f193.google.com with SMTP id k3so620862pfc.2; Tue, 22 Aug 2017 01:11:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=nl7jXWp9r04BdEgWiJSAjXUM8qV4V2297k3OW8i1MVo=; b=P2eSb4yHC972y82vyt4UnELAMJHYM0Pb9eC4KmwJjAcRL4ZotYqWj7UQtuHMoYxHTR bgJPT49vo/xm3JXTy6f6onleZkro5jSvxfF3Cr06JWhvt0AZLFNQ+8ZAtDGpDia3QTkK 0nsORcGjko7z29TS/yYUcMK0NqxYZQvhxPcAODZZDmnelSpMkQV5OYcj4N6pM48TDuvs 3iN4JNDvdlpIW/PYpBGaZOaaJeMGFgn4p222mxHGs0+BGSx0PW7JXy+Mcp5ke/QKhduH HIQacF7OAj/jp9Ep/72QqQm1TxNMk2s0gC7mAfqPPbaxyrRjbjBZgXEFAdYPENLybx6o hQ6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=nl7jXWp9r04BdEgWiJSAjXUM8qV4V2297k3OW8i1MVo=; b=BpxVo7xI2YvqesF6w4asH/gEZOpvYKzBJYqeqjBfkV+anvbgxRubzsO5qukO8RBp7n Sz6i/g8K1IZiRfySkq5AlllZrNtYHFo8xZDa9omz7+AP2Zgfb43QDd4FocUow3XOsE3m LQ+ma3wsw/uGq204NutKj4+xBaz4K5EBEAwyRpkvRotGeqYpeklREZjHhrpti3j1Qea3 YP3VDtMdRrSZttkNPSGTybsKS3b9xyX0B9NGaqCCsKMGiOOsf/fMyNBf0QCeBuP8bL6r f1Au25+Xj4gdwX14jJOQQmyf4B97Gja2lCS7qPM3sMg1BBM1WQmcrFp1/5ARx+FG2pYA HlwA== X-Gm-Message-State: AHYfb5jioQibh57KjRtg+ttkE+405aHLIZsBBgdcaMdnERuWGMxVkdN9 sPMiyQhaH92x8A== X-Received: by 10.84.237.1 with SMTP id s1mr14319849plk.313.1503389500522; Tue, 22 Aug 2017 01:11:40 -0700 (PDT) Received: from localhost.localdomain ([103.46.192.10]) by smtp.gmail.com with ESMTPSA id z189sm22154147pgb.12.2017.08.22.01.11.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 01:11:39 -0700 (PDT) From: Himanshu Jha To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Himanshu Jha Subject: [PATCH] drivers: net: wireless: atmel: check memory allocation failure Date: Tue, 22 Aug 2017 13:41:21 +0530 Message-Id: <1503389481-4988-1-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check memory allocation failure and return -ENOMEM if failure occurs. Signed-off-by: Himanshu Jha --- drivers/net/wireless/atmel/at76c50x-usb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c index 09defbc..73f0924 100644 --- a/drivers/net/wireless/atmel/at76c50x-usb.c +++ b/drivers/net/wireless/atmel/at76c50x-usb.c @@ -940,7 +940,7 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv) GFP_KERNEL); if (!m) - return; + return -ENOMEM; ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m, sizeof(struct mib_mac_addr)); @@ -969,7 +969,7 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv) struct mib_mac_wep *m = kmalloc(sizeof(struct mib_mac_wep), GFP_KERNEL); if (!m) - return; + return -ENOMEM; ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m, sizeof(struct mib_mac_wep)); @@ -1006,7 +1006,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) GFP_KERNEL); if (!m) - return; + return -ENOMEM; ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m, sizeof(struct mib_mac_mgmt)); @@ -1043,7 +1043,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv) struct mib_mac *m = kmalloc(sizeof(struct mib_mac), GFP_KERNEL); if (!m) - return; + return -ENOMEM; ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); if (ret < 0) { @@ -1080,7 +1080,7 @@ static void at76_dump_mib_phy(struct at76_priv *priv) struct mib_phy *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL); if (!m) - return; + return -ENOMEM; ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); if (ret < 0) { @@ -1113,7 +1113,7 @@ static void at76_dump_mib_local(struct at76_priv *priv) struct mib_local *m = kmalloc(sizeof(*m), GFP_KERNEL); if (!m) - return; + return -ENOMEM; ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(*m)); if (ret < 0) { @@ -1138,7 +1138,7 @@ static void at76_dump_mib_mdomain(struct at76_priv *priv) struct mib_mdomain *m = kmalloc(sizeof(struct mib_mdomain), GFP_KERNEL); if (!m) - return; + return -ENOMEM; ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m, sizeof(struct mib_mdomain));