From patchwork Wed Aug 23 14:29:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 9917477 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 12933603FA for ; Wed, 23 Aug 2017 14:29:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 050DD2875B for ; Wed, 23 Aug 2017 14:29:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE0FC28816; Wed, 23 Aug 2017 14:29:47 +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 9E66E2875B for ; Wed, 23 Aug 2017 14:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932154AbdHWO3o (ORCPT ); Wed, 23 Aug 2017 10:29:44 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35191 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932146AbdHWO3n (ORCPT ); Wed, 23 Aug 2017 10:29:43 -0400 Received: by mail-pf0-f195.google.com with SMTP id k3so216690pfc.2; Wed, 23 Aug 2017 07:29:43 -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=l50Dpw8B/MKa4JMsrOhqov6DhFCOM+3vzkTCSdxRXUo=; b=EWCAnpzWAQsINFyJwzOMsgmq2enSMxcPsk5J1B5i7V9SWNsjcokuH/Ejhc58qpB2Mt 4+SwdQ7Zb8CZITM+/F7L3zCGtSTtlnpwF+qsENH9KTjK4EmLtAQQJrEuQdO5oTW5bAAQ OhNDMHFP+k0Jr65FkQkBgkuFHT/5eTKJGum/IoRUdCzc2AFcUNm6d+cHMxipJa5uyhBW 7EAAWX7XmFMhwMuRG71i5aI2Gv7xCXDdUbcxAFWqFcs2s3/oLWpbH5wglcWfthxSTgL/ DG0zluVf3eoOz/jGLgcHypPhabq+jkLbEW0xX5B8q4DKOq7Z9aJaDb1U5ASCEUPEr33T gnUQ== 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=l50Dpw8B/MKa4JMsrOhqov6DhFCOM+3vzkTCSdxRXUo=; b=MzywFmt5ksnD7y6thWFL+UErDpzvhkITvfYqVJ/Xfkhz5DB/Zb7oOsHhowTv1EXoVJ wme9ILLRg8XEXC+3VRAwzTLtOWa2fLLns/SSw9zC7Z306UOffPvhA4yYk68E/Y8kbEPb 7UpxKdrLNbMIwJ86M3HYmPS4GU4FPUqGaQ9Q5BzirC5qkh5Tptq3PPiAf1hkpjZt6VhR kRgMobLzcfdT9uiUGA3ejA7M2DRdFz4I6tWJe7e4AtpIa85PxLbqftXe3+sW5AKsKlh+ +ow15y9Twl01NYr2UjB92T4ZC91tVbNHysrHZBblu1dT2RxbzTXAOqjAfI/rXB/50o1T UESA== X-Gm-Message-State: AHYfb5jpPXCOiVD13g7WqDYXtIaYYMJgVzIs9EWpMaXruzqQJA/YbVNm LDKy03OXI1F+6A== X-Received: by 10.98.65.199 with SMTP id g68mr2994502pfd.157.1503498582558; Wed, 23 Aug 2017 07:29:42 -0700 (PDT) Received: from localhost.localdomain ([103.46.192.10]) by smtp.gmail.com with ESMTPSA id k81sm3559388pfb.152.2017.08.23.07.29.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Aug 2017 07:29:41 -0700 (PDT) From: Himanshu Jha To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Himanshu Jha Subject: [PATCH v2] at76c50x-usb: check memory allocation failure Date: Wed, 23 Aug 2017 19:59:16 +0530 Message-Id: <1503498556-13835-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 rather than just retuning void. Signed-off-by: Himanshu Jha --- drivers/net/wireless/atmel/at76c50x-usb.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c index 09defbc..ceb453b 100644 --- a/drivers/net/wireless/atmel/at76c50x-usb.c +++ b/drivers/net/wireless/atmel/at76c50x-usb.c @@ -932,7 +932,7 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff) return ret; } -static void at76_dump_mib_mac_addr(struct at76_priv *priv) +static int at76_dump_mib_mac_addr(struct at76_priv *priv) { int i; int ret; @@ -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)); @@ -961,7 +961,7 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv) kfree(m); } -static void at76_dump_mib_mac_wep(struct at76_priv *priv) +static int at76_dump_mib_mac_wep(struct at76_priv *priv) { int i; int ret; @@ -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)); @@ -999,14 +999,14 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv) kfree(m); } -static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) +static int at76_dump_mib_mac_mgmt(struct at76_priv *priv) { int ret; struct mib_mac_mgmt *m = kmalloc(sizeof(struct mib_mac_mgmt), GFP_KERNEL); if (!m) - return; + return -ENOMEM; ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m, sizeof(struct mib_mac_mgmt)); @@ -1037,13 +1037,13 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) kfree(m); } -static void at76_dump_mib_mac(struct at76_priv *priv) +static int at76_dump_mib_mac(struct at76_priv *priv) { int ret; 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) { @@ -1074,13 +1074,13 @@ static void at76_dump_mib_mac(struct at76_priv *priv) kfree(m); } -static void at76_dump_mib_phy(struct at76_priv *priv) +static int at76_dump_mib_phy(struct at76_priv *priv) { int ret; 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) { @@ -1107,13 +1107,13 @@ static void at76_dump_mib_phy(struct at76_priv *priv) kfree(m); } -static void at76_dump_mib_local(struct at76_priv *priv) +static int at76_dump_mib_local(struct at76_priv *priv) { int ret; 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) { @@ -1132,13 +1132,13 @@ static void at76_dump_mib_local(struct at76_priv *priv) kfree(m); } -static void at76_dump_mib_mdomain(struct at76_priv *priv) +static int at76_dump_mib_mdomain(struct at76_priv *priv) { int ret; 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));