From patchwork Fri Mar 6 08:21:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Lambert X-Patchwork-Id: 5950531 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0801A9F36A for ; Fri, 6 Mar 2015 08:22:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 170A8202E9 for ; Fri, 6 Mar 2015 08:22:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DAB420425 for ; Fri, 6 Mar 2015 08:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932328AbbCFIVp (ORCPT ); Fri, 6 Mar 2015 03:21:45 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:41078 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbbCFIVn (ORCPT ); Fri, 6 Mar 2015 03:21:43 -0500 Received: by wiwl15 with SMTP id l15so1693340wiw.0; Fri, 06 Mar 2015 00:21:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=k93C+hQG3h6jYxP+KYwkFknjHLNAYVMBePksg8XoiX4=; b=mtUqvkhUfw8zssshBXKgsABE38sddEUy2R/DxkdGcYDKDxIQvyt+NdfuHZnRKyEqtC q41oeSb4NypCrtvh/0mhCiHoyzDkH/5XnZQ8XWXxVASxA0BF/Z7VKbRkEgOWBKW5xtiB p7Ve3TkrpgMQ9HzIMlvXpz5fabE2XGZQL6427KMi1FGpJZi8XaUx6VkEYo0CeQJNgYzW gEMw/dIamO1QAHZAD7T3+KXQR76Cjg6g/9NaF5r+Bb6GvyJLVl+KGgCWT+bKtQn5pZMU tA3n7SP3Fj8g6JDQh0pMXjaMMmAHnH2D5/9kVAlxoWhAFNcqKlx60KliDHXUYMaVYiiX Xj0w== X-Received: by 10.180.102.73 with SMTP id fm9mr31447713wib.12.1425630102128; Fri, 06 Mar 2015 00:21:42 -0800 (PST) Received: from sloth (hp-quentin.rsr.lip6.fr. [132.227.76.76]) by mx.google.com with ESMTPSA id ch6sm13870622wjc.3.2015.03.06.00.21.39 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Mar 2015 00:21:41 -0800 (PST) Date: Fri, 6 Mar 2015 09:21:40 +0100 From: Quentin Lambert To: Larry Finger , Jes Sorensen , Greg Kroah-Hartman Cc: kernel-janitors@vger.kernel.org, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] staging: rtl8723au: Remove unnecessary OOM message Message-ID: <20150306082140.GA9740@sloth> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch reduces the kernel size by removing error messages that duplicate the normal OOM message. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @@ identifier f,print,l; expression e; constant char[] c; @@ e = \(kzalloc\|kmalloc\|devm_kzalloc\|devm_kmalloc\)(...); if (e == NULL) { <+... - print(...,c,...); ... when any ( goto l; | return ...; ) ...+> } Signed-off-by: Quentin Lambert --- drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 8 ++------ drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 8 ++------ drivers/staging/rtl8723au/hal/usb_ops_linux.c | 6 +----- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 5 ----- 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c index 7b56411..38f5b7f 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c @@ -462,10 +462,8 @@ static void SetFwRsvdPagePkt(struct rtw_adapter *padapter, bool bDLFinished) DBG_8723A("%s\n", __func__); ReservedPagePacket = kzalloc(1000, GFP_KERNEL); - if (ReservedPagePacket == NULL) { - DBG_8723A("%s: alloc ReservedPagePacket fail!\n", __func__); + if (ReservedPagePacket == NULL) return; - } pHalData = GET_HAL_DATA(padapter); pxmitpriv = &padapter->xmitpriv; @@ -669,10 +667,8 @@ static void SetFwRsvdPagePkt_BTCoex(struct rtw_adapter *padapter) DBG_8723A("+%s\n", __func__); ReservedPagePacket = kzalloc(1024, GFP_KERNEL); - if (ReservedPagePacket == NULL) { - DBG_8723A("%s: alloc ReservedPagePacket fail!\n", __func__); + if (ReservedPagePacket == NULL) return; - } pHalData = GET_HAL_DATA(padapter); pxmitpriv = &padapter->xmitpriv; diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index a5eadd4..6d50b09 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -401,10 +401,8 @@ hal_ReadEFuse_WiFi(struct rtw_adapter *padapter, } efuseTbl = kmalloc(EFUSE_MAP_LEN_8723A, GFP_KERNEL); - if (efuseTbl == NULL) { - DBG_8723A("%s: alloc efuseTbl fail!\n", __func__); + if (efuseTbl == NULL) return; - } /* 0xff will be efuse default value instead of 0x00. */ memset(efuseTbl, 0xFF, EFUSE_MAP_LEN_8723A); @@ -494,10 +492,8 @@ hal_ReadEFuse_BT(struct rtw_adapter *padapter, } efuseTbl = kmalloc(EFUSE_BT_MAP_LEN, GFP_KERNEL); - if (efuseTbl == NULL) { - DBG_8723A("%s: efuseTbl malloc fail!\n", __func__); + if (efuseTbl == NULL) return; - } /* 0xff will be efuse default value instead of 0x00. */ memset(efuseTbl, 0xFF, EFUSE_BT_MAP_LEN); diff --git a/drivers/staging/rtl8723au/hal/usb_ops_linux.c b/drivers/staging/rtl8723au/hal/usb_ops_linux.c index a6d16ad..f1e9202 100644 --- a/drivers/staging/rtl8723au/hal/usb_ops_linux.c +++ b/drivers/staging/rtl8723au/hal/usb_ops_linux.c @@ -256,12 +256,8 @@ static void usb_read_interrupt_complete(struct urb *purb) c2w = kmalloc(sizeof(struct evt_work), GFP_ATOMIC); - if (!c2w) { - printk(KERN_WARNING "%s: unable to " - "allocate work buffer\n", - __func__); + if (!c2w) goto urb_submit; - } c2w->adapter = padapter; INIT_WORK(&c2w->work, rtw_evt_work); diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 537bd82..40bdf4b 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -1327,8 +1327,6 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct rtw_adapter *padapter, pmlmepriv->wps_probe_req_ie = kmemdup(wps_ie, wps_ie[1], GFP_KERNEL); if (pmlmepriv->wps_probe_req_ie == NULL) { - DBG_8723A("%s()-%d: kmalloc() ERROR!\n", - __func__, __LINE__); return -EINVAL; } pmlmepriv->wps_probe_req_ie_len = wps_ie[1]; @@ -2619,8 +2617,6 @@ static int rtw_cfg80211_add_monitor_if(struct rtw_adapter *padapter, char *name, /* wdev */ mon_wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (!mon_wdev) { - DBG_8723A("%s(%s): allocate mon_wdev fail\n", __func__, - padapter->pnetdev->name); ret = -ENOMEM; goto out; } @@ -3275,7 +3271,6 @@ int rtw_wdev_alloc(struct rtw_adapter *padapter, struct device *dev) /* wdev */ wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (!wdev) { - DBG_8723A("Couldn't allocate wireless device\n"); ret = -ENOMEM; goto free_wiphy; }