Message ID | 1667221322-8317-1-git-send-email-zhangchangzhong@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2290229wru; Mon, 31 Oct 2022 05:43:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GDmj9rdh7fWnzvuG3xpS/BXTAtkj5Vko5HJduKUKByeTB/24UTeO1HVYmwoBfhQJu1mxX X-Received: by 2002:a17:90b:3b8d:b0:20d:5c7a:abf1 with SMTP id pc13-20020a17090b3b8d00b0020d5c7aabf1mr15102555pjb.118.1667220192164; Mon, 31 Oct 2022 05:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667220192; cv=none; d=google.com; s=arc-20160816; b=I4OEY7WzZs9upXO/RqT/IfqgkDauVy3p7Jhxz3dRvCsbwMfoZp5Swqi6n5qtyo2I2w YslfJwq+Re9ZACfoKwbqDpoxrCrTS2HMHy/oPj28qnLvL3jVK0j0SdJTrKbz1j8qZWjc gnoWgkznZwWPK7ZZN13F+eyKRAOjv+aOMuLJBv5026KCWq3h5WrgeQ7dGANUquM3qYG5 VWCYe4ODpdKkrCa5CqoLeGs5DtkIbK5mV8pIsNnmwcTfLG+0BsDeqUo9ZxW1SOBlNuQD pDQ6BSu02pgyRteX68qBDXLkUq0eg3c6jQ4SOUX7ulmX7ERkvDnEPYosvQLJkO57Xb0+ tg4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=6htU0tTWIwHQv9j4sfW/CZN9rTFdCZEIugSygW2attI=; b=UaOQUjmJFfAPUQ5zCNnZdaBW4bHKX/mmT6Pb4OH9J7J6CXUDBPykRJqdn7vbUAOmgt urABxTHtoY/KsebGcnAVCifBDxXG/BIZ+XL5uZwcZnA93QQU8BYCf6pZ0g7HWKFTcj/b o/HOjpofFUzhrs9Mqs2pcNZwU1D3V4iGz12sTYaUTQGk5YAKTDFPP4is8f+yKtMPOJjB 6h9phzVLg0utx9S/FYZVb9M8gwrkpg+7CdyiYoWu/OO9dU+eDuFgNfEEludwu7mEll9r PIfWt/PTIatG5DJGiKjWTavlfSgXeXzPJsb4GqkIM8CJvhPNBSLoHxNp76lMNQUJXTnE yvpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ls7-20020a17090b350700b001fde53d5d79si10310624pjb.5.2022.10.31.05.42.56; Mon, 31 Oct 2022 05:43:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbiJaMmU (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Mon, 31 Oct 2022 08:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbiJaMmS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Oct 2022 08:42:18 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C7157673; Mon, 31 Oct 2022 05:42:17 -0700 (PDT) Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N1CPc2ljqzpW2h; Mon, 31 Oct 2022 20:38:44 +0800 (CST) Received: from dggpeml500006.china.huawei.com (7.185.36.76) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 31 Oct 2022 20:42:15 +0800 Received: from localhost.localdomain (10.175.112.70) by dggpeml500006.china.huawei.com (7.185.36.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 31 Oct 2022 20:42:14 +0800 From: Zhang Changzhong <zhangchangzhong@huawei.com> To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Jeff Garzik <jgarzik@pobox.com>, Finn Thain <fthain@linux-m68k.org> CC: Zhang Changzhong <zhangchangzhong@huawei.com>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH net] net/sonic: use dma_mapping_error() for error check Date: Mon, 31 Oct 2022 21:02:02 +0800 Message-ID: <1667221322-8317-1-git-send-email-zhangchangzhong@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.70] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500006.china.huawei.com (7.185.36.76) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748207080076350629?= X-GMAIL-MSGID: =?utf-8?q?1748207080076350629?= |
Series |
[net] net/sonic: use dma_mapping_error() for error check
|
|
Commit Message
Zhang Changzhong
Oct. 31, 2022, 1:02 p.m. UTC
The DMA address returned by dma_map_single() should be checked with
dma_mapping_error(). Fix it accordingly.
Fixes: efcce839360f ("[PATCH] macsonic/jazzsonic network drivers update")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
drivers/net/ethernet/natsemi/sonic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Hi Zhang,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net/master]
url: https://github.com/intel-lab-lkp/linux/commits/Zhang-Changzhong/net-sonic-use-dma_mapping_error-for-error-check/20221031-204340
patch link: https://lore.kernel.org/r/1667221322-8317-1-git-send-email-zhangchangzhong%40huawei.com
patch subject: [PATCH net] net/sonic: use dma_mapping_error() for error check
config: m68k-defconfig
compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/837273d17ba29bbc661c5c82432e83ce4198200a
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Zhang-Changzhong/net-sonic-use-dma_mapping_error-for-error-check/20221031-204340
git checkout 837273d17ba29bbc661c5c82432e83ce4198200a
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/net/ethernet/natsemi/macsonic.c:533:
drivers/net/ethernet/natsemi/sonic.c: In function 'sonic_send_packet':
drivers/net/ethernet/natsemi/sonic.c:295:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
295 | if (dma_mapping_error(lp->device, laddr))
| ^~
drivers/net/ethernet/natsemi/sonic.c:297:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
297 | dev_kfree_skb_any(skb);
| ^~~~~~~~~~~~~~~~~
drivers/net/ethernet/natsemi/sonic.c:279:23: warning: unused variable 'flags' [-Wunused-variable]
279 | unsigned long flags;
| ^~~~~
drivers/net/ethernet/natsemi/sonic.c:278:13: warning: unused variable 'entry' [-Wunused-variable]
278 | int entry;
| ^~~~~
In file included from include/linux/kref.h:16,
from include/linux/mm_types.h:8,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from drivers/net/ethernet/natsemi/macsonic.c:36:
drivers/net/ethernet/natsemi/sonic.c: At top level:
include/linux/spinlock.h:379:1: error: expected identifier or '(' before 'do'
379 | do { \
| ^~
drivers/net/ethernet/natsemi/sonic.c:301:9: note: in expansion of macro 'spin_lock_irqsave'
301 | spin_lock_irqsave(&lp->lock, flags);
| ^~~~~~~~~~~~~~~~~
include/linux/spinlock.h:381:3: error: expected identifier or '(' before 'while'
381 | } while (0)
| ^~~~~
drivers/net/ethernet/natsemi/sonic.c:301:9: note: in expansion of macro 'spin_lock_irqsave'
301 | spin_lock_irqsave(&lp->lock, flags);
| ^~~~~~~~~~~~~~~~~
drivers/net/ethernet/natsemi/sonic.c:303:9: warning: data definition has no type or storage class
303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK;
| ^~~~~
drivers/net/ethernet/natsemi/sonic.c:303:9: error: type defaults to 'int' in declaration of 'entry' [-Werror=implicit-int]
drivers/net/ethernet/natsemi/sonic.c:303:18: error: 'lp' undeclared here (not in a function); did you mean 'up'?
303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK;
| ^~
| up
drivers/net/ethernet/natsemi/sonic.c:305:34: error: expected ')' before numeric constant
305 | sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */
| ^
| )
drivers/net/ethernet/natsemi/sonic.c:306:34: error: expected ')' before numeric constant
306 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */
| ^
| )
drivers/net/ethernet/natsemi/sonic.c:307:34: error: expected ')' before numeric constant
307 | sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */
| ^
| )
drivers/net/ethernet/natsemi/sonic.c:308:34: error: expected ')' before numeric constant
308 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_L, laddr & 0xffff);
| ^
| )
drivers/net/ethernet/natsemi/sonic.c:309:34: error: expected ')' before numeric constant
309 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_H, laddr >> 16);
| ^
| )
drivers/net/ethernet/natsemi/sonic.c:310:34: error: expected ')' before numeric constant
310 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_SIZE, length);
| ^
| )
drivers/net/ethernet/natsemi/sonic.c:311:34: error: expected ')' before numeric constant
311 | sonic_tda_put(dev, entry, SONIC_TD_LINK,
| ^
| )
drivers/net/ethernet/natsemi/sonic.c:314:30: error: expected ')' before '->' token
314 | sonic_tda_put(dev, lp->eol_tx, SONIC_TD_LINK, ~SONIC_EOL &
| ^~
| )
In file included from include/linux/skbuff.h:45,
from include/net/net_namespace.h:43,
from include/linux/netdevice.h:38,
from drivers/net/ethernet/natsemi/macsonic.c:47:
>> include/net/net_debug.h:123:2: error: expected identifier or '(' before '{' token
123 | ({ \
| ^
drivers/net/ethernet/natsemi/sonic.c:317:9: note: in expansion of macro 'netif_dbg'
317 | netif_dbg(lp, tx_queued, dev, "%s: issuing Tx command\n", __func__);
| ^~~~~~~~~
In file included from arch/m68k/include/asm/io_mm.h:25,
from arch/m68k/include/asm/io.h:8,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from drivers/net/ethernet/natsemi/macsonic.c:40:
arch/m68k/include/asm/raw_io.h:31:27: error: expected identifier or '(' before 'void'
31 | #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))
| ^~~~
arch/m68k/include/asm/raw_io.h:44:28: note: in expansion of macro 'out_be16'
44 | #define raw_outw(val,port) out_be16((port),(val))
| ^~~~~~~~
arch/m68k/include/asm/nubus.h:13:22: note: in expansion of macro 'raw_outw'
13 | #define nubus_writew raw_outw
| ^~~~~~~~
drivers/net/ethernet/natsemi/macsonic.c:70:31: note: in expansion of macro 'nubus_writew'
70 | #define SONIC_WRITE(reg,val) (nubus_writew(val, dev->base_addr + (reg * 4) \
| ^~~~~~~~~~~~
drivers/net/ethernet/natsemi/sonic.c:319:9: note: in expansion of macro 'SONIC_WRITE'
319 | SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP);
| ^~~~~~~~~~~
arch/m68k/include/asm/raw_io.h:31:32: error: expected ')' before '(' token
31 | #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))
| ^
arch/m68k/include/asm/raw_io.h:44:28: note: in expansion of macro 'out_be16'
44 | #define raw_outw(val,port) out_be16((port),(val))
| ^~~~~~~~
arch/m68k/include/asm/nubus.h:13:22: note: in expansion of macro 'raw_outw'
13 | #define nubus_writew raw_outw
| ^~~~~~~~
drivers/net/ethernet/natsemi/macsonic.c:70:31: note: in expansion of macro 'nubus_writew'
70 | #define SONIC_WRITE(reg,val) (nubus_writew(val, dev->base_addr + (reg * 4) \
| ^~~~~~~~~~~~
drivers/net/ethernet/natsemi/sonic.c:319:9: note: in expansion of macro 'SONIC_WRITE'
319 | SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP);
| ^~~~~~~~~~~
drivers/net/ethernet/natsemi/sonic.c:321:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
321 | lp->tx_len[entry] = length;
| ^~
drivers/net/ethernet/natsemi/sonic.c:322:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
322 | lp->tx_laddr[entry] = laddr;
| ^~
drivers/net/ethernet/natsemi/sonic.c:323:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
323 | lp->tx_skb[entry] = skb;
| ^~
drivers/net/ethernet/natsemi/sonic.c:325:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
325 | lp->eol_tx = entry;
| ^~
drivers/net/ethernet/natsemi/sonic.c:327:9: warning: data definition has no type or storage class
327 | entry = (entry + 1) & SONIC_TDS_MASK;
| ^~~~~
drivers/net/ethernet/natsemi/sonic.c:327:9: error: type defaults to 'int' in declaration of 'entry' [-Werror=implicit-int]
drivers/net/ethernet/natsemi/sonic.c:327:9: error: redefinition of 'entry'
drivers/net/ethernet/natsemi/sonic.c:303:9: note: previous definition of 'entry' with type 'int'
303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK;
| ^~~~~
drivers/net/ethernet/natsemi/sonic.c:327:17: error: initializer element is not constant
327 | entry = (entry + 1) & SONIC_TDS_MASK;
| ^
drivers/net/ethernet/natsemi/sonic.c:328:9: error: expected identifier or '(' before 'if'
328 | if (lp->tx_skb[entry]) {
| ^~
drivers/net/ethernet/natsemi/sonic.c:335:32: error: expected declaration specifiers or '...' before '&' token
335 | spin_unlock_irqrestore(&lp->lock, flags);
| ^
drivers/net/ethernet/natsemi/sonic.c:335:43: error: unknown type name 'flags'
335 | spin_unlock_irqrestore(&lp->lock, flags);
| ^~~~~
drivers/net/ethernet/natsemi/sonic.c:337:9: error: expected identifier or '(' before 'return'
337 | return NETDEV_TX_OK;
| ^~~~~~
drivers/net/ethernet/natsemi/sonic.c:338:1: error: expected identifier or '(' before '}' token
338 | }
| ^
cc1: some warnings being treated as errors
vim +123 include/net/net_debug.h
5b87be9e4978fe Eric Dumazet 2022-05-09 95
5b87be9e4978fe Eric Dumazet 2022-05-09 96 #define netif_emerg(priv, type, dev, fmt, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 97 netif_level(emerg, priv, type, dev, fmt, ##args)
5b87be9e4978fe Eric Dumazet 2022-05-09 98 #define netif_alert(priv, type, dev, fmt, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 99 netif_level(alert, priv, type, dev, fmt, ##args)
5b87be9e4978fe Eric Dumazet 2022-05-09 100 #define netif_crit(priv, type, dev, fmt, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 101 netif_level(crit, priv, type, dev, fmt, ##args)
5b87be9e4978fe Eric Dumazet 2022-05-09 102 #define netif_err(priv, type, dev, fmt, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 103 netif_level(err, priv, type, dev, fmt, ##args)
5b87be9e4978fe Eric Dumazet 2022-05-09 104 #define netif_warn(priv, type, dev, fmt, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 105 netif_level(warn, priv, type, dev, fmt, ##args)
5b87be9e4978fe Eric Dumazet 2022-05-09 106 #define netif_notice(priv, type, dev, fmt, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 107 netif_level(notice, priv, type, dev, fmt, ##args)
5b87be9e4978fe Eric Dumazet 2022-05-09 108 #define netif_info(priv, type, dev, fmt, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 109 netif_level(info, priv, type, dev, fmt, ##args)
5b87be9e4978fe Eric Dumazet 2022-05-09 110
5b87be9e4978fe Eric Dumazet 2022-05-09 111 #if defined(CONFIG_DYNAMIC_DEBUG) || \
5b87be9e4978fe Eric Dumazet 2022-05-09 112 (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
5b87be9e4978fe Eric Dumazet 2022-05-09 113 #define netif_dbg(priv, type, netdev, format, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 114 do { \
5b87be9e4978fe Eric Dumazet 2022-05-09 115 if (netif_msg_##type(priv)) \
5b87be9e4978fe Eric Dumazet 2022-05-09 116 dynamic_netdev_dbg(netdev, format, ##args); \
5b87be9e4978fe Eric Dumazet 2022-05-09 117 } while (0)
5b87be9e4978fe Eric Dumazet 2022-05-09 118 #elif defined(DEBUG)
5b87be9e4978fe Eric Dumazet 2022-05-09 119 #define netif_dbg(priv, type, dev, format, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 120 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
5b87be9e4978fe Eric Dumazet 2022-05-09 121 #else
5b87be9e4978fe Eric Dumazet 2022-05-09 122 #define netif_dbg(priv, type, dev, format, args...) \
5b87be9e4978fe Eric Dumazet 2022-05-09 @123 ({ \
5b87be9e4978fe Eric Dumazet 2022-05-09 124 if (0) \
5b87be9e4978fe Eric Dumazet 2022-05-09 125 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
5b87be9e4978fe Eric Dumazet 2022-05-09 126 0; \
5b87be9e4978fe Eric Dumazet 2022-05-09 127 })
5b87be9e4978fe Eric Dumazet 2022-05-09 128 #endif
5b87be9e4978fe Eric Dumazet 2022-05-09 129
Hi Zhang, Thank you for the patch! Yet something to improve: [auto build test ERROR on net/master] url: https://github.com/intel-lab-lkp/linux/commits/Zhang-Changzhong/net-sonic-use-dma_mapping_error-for-error-check/20221031-204340 patch link: https://lore.kernel.org/r/1667221322-8317-1-git-send-email-zhangchangzhong%40huawei.com patch subject: [PATCH net] net/sonic: use dma_mapping_error() for error check config: mips-jazz_defconfig compiler: mipsel-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/837273d17ba29bbc661c5c82432e83ce4198200a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Zhang-Changzhong/net-sonic-use-dma_mapping_error-for-error-check/20221031-204340 git checkout 837273d17ba29bbc661c5c82432e83ce4198200a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): In file included from drivers/net/ethernet/natsemi/jazzsonic.c:228: drivers/net/ethernet/natsemi/sonic.c: In function 'sonic_send_packet': drivers/net/ethernet/natsemi/sonic.c:295:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation] 295 | if (dma_mapping_error(lp->device, laddr)) | ^~ drivers/net/ethernet/natsemi/sonic.c:297:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 297 | dev_kfree_skb_any(skb); | ^~~~~~~~~~~~~~~~~ drivers/net/ethernet/natsemi/sonic.c:279:23: warning: unused variable 'flags' [-Wunused-variable] 279 | unsigned long flags; | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:278:13: warning: unused variable 'entry' [-Wunused-variable] 278 | int entry; | ^~~~~ In file included from include/linux/kref.h:16, from include/linux/mm_types.h:8, from include/linux/buildid.h:5, from include/linux/module.h:14, from drivers/net/ethernet/natsemi/jazzsonic.c:23: drivers/net/ethernet/natsemi/sonic.c: At top level: include/linux/spinlock.h:379:1: error: expected identifier or '(' before 'do' 379 | do { \ | ^~ drivers/net/ethernet/natsemi/sonic.c:301:9: note: in expansion of macro 'spin_lock_irqsave' 301 | spin_lock_irqsave(&lp->lock, flags); | ^~~~~~~~~~~~~~~~~ include/linux/spinlock.h:381:3: error: expected identifier or '(' before 'while' 381 | } while (0) | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:301:9: note: in expansion of macro 'spin_lock_irqsave' 301 | spin_lock_irqsave(&lp->lock, flags); | ^~~~~~~~~~~~~~~~~ drivers/net/ethernet/natsemi/sonic.c:303:9: warning: data definition has no type or storage class 303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:303:9: error: type defaults to 'int' in declaration of 'entry' [-Werror=implicit-int] drivers/net/ethernet/natsemi/sonic.c:303:18: error: 'lp' undeclared here (not in a function); did you mean 'up'? 303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; | ^~ | up drivers/net/ethernet/natsemi/sonic.c:305:34: error: expected ')' before numeric constant 305 | sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ | ^ | ) drivers/net/ethernet/natsemi/sonic.c:306:34: error: expected ')' before numeric constant 306 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */ | ^ | ) drivers/net/ethernet/natsemi/sonic.c:307:34: error: expected ')' before numeric constant 307 | sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */ | ^ | ) drivers/net/ethernet/natsemi/sonic.c:308:34: error: expected ')' before numeric constant 308 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_L, laddr & 0xffff); | ^ | ) drivers/net/ethernet/natsemi/sonic.c:309:34: error: expected ')' before numeric constant 309 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_H, laddr >> 16); | ^ | ) drivers/net/ethernet/natsemi/sonic.c:310:34: error: expected ')' before numeric constant 310 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_SIZE, length); | ^ | ) drivers/net/ethernet/natsemi/sonic.c:311:34: error: expected ')' before numeric constant 311 | sonic_tda_put(dev, entry, SONIC_TD_LINK, | ^ | ) drivers/net/ethernet/natsemi/sonic.c:314:30: error: expected ')' before '->' token 314 | sonic_tda_put(dev, lp->eol_tx, SONIC_TD_LINK, ~SONIC_EOL & | ^~ | ) In file included from include/linux/skbuff.h:45, from include/net/net_namespace.h:43, from include/linux/netdevice.h:38, from drivers/net/ethernet/natsemi/jazzsonic.c:33: include/net/net_debug.h:123:2: error: expected identifier or '(' before '{' token 123 | ({ \ | ^ drivers/net/ethernet/natsemi/sonic.c:317:9: note: in expansion of macro 'netif_dbg' 317 | netif_dbg(lp, tx_queued, dev, "%s: issuing Tx command\n", __func__); | ^~~~~~~~~ >> drivers/net/ethernet/natsemi/jazzsonic.c:59:1: error: expected identifier or '(' before 'do' 59 | do { \ | ^~ drivers/net/ethernet/natsemi/sonic.c:319:9: note: in expansion of macro 'SONIC_WRITE' 319 | SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); | ^~~~~~~~~~~ >> drivers/net/ethernet/natsemi/jazzsonic.c:61:3: error: expected identifier or '(' before 'while' 61 | } while (0) | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:319:9: note: in expansion of macro 'SONIC_WRITE' 319 | SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); | ^~~~~~~~~~~ drivers/net/ethernet/natsemi/sonic.c:321:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token 321 | lp->tx_len[entry] = length; | ^~ drivers/net/ethernet/natsemi/sonic.c:322:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token 322 | lp->tx_laddr[entry] = laddr; | ^~ drivers/net/ethernet/natsemi/sonic.c:323:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token 323 | lp->tx_skb[entry] = skb; | ^~ drivers/net/ethernet/natsemi/sonic.c:325:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token 325 | lp->eol_tx = entry; | ^~ drivers/net/ethernet/natsemi/sonic.c:327:9: warning: data definition has no type or storage class 327 | entry = (entry + 1) & SONIC_TDS_MASK; | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:327:9: error: type defaults to 'int' in declaration of 'entry' [-Werror=implicit-int] drivers/net/ethernet/natsemi/sonic.c:327:9: error: redefinition of 'entry' drivers/net/ethernet/natsemi/sonic.c:303:9: note: previous definition of 'entry' with type 'int' 303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:327:17: error: initializer element is not constant 327 | entry = (entry + 1) & SONIC_TDS_MASK; | ^ drivers/net/ethernet/natsemi/sonic.c:328:9: error: expected identifier or '(' before 'if' 328 | if (lp->tx_skb[entry]) { | ^~ drivers/net/ethernet/natsemi/sonic.c:335:32: error: expected declaration specifiers or '...' before '&' token 335 | spin_unlock_irqrestore(&lp->lock, flags); | ^ drivers/net/ethernet/natsemi/sonic.c:335:43: error: unknown type name 'flags' 335 | spin_unlock_irqrestore(&lp->lock, flags); | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:337:9: error: expected identifier or '(' before 'return' 337 | return NETDEV_TX_OK; | ^~~~~~ drivers/net/ethernet/natsemi/sonic.c:338:1: error: expected identifier or '(' before '}' token 338 | } | ^ cc1: some warnings being treated as errors vim +59 drivers/net/ethernet/natsemi/jazzsonic.c ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 57 ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 58 #define SONIC_WRITE(reg,val) \ ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 @59 do { \ efcce839360fb3 drivers/net/jazzsonic.c Finn Thain 2005-08-20 60 *((volatile unsigned int *)dev->base_addr+(reg)) = (val); \ ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 @61 } while (0) ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 62
On 2022/11/2 7:04, kernel test robot wrote: > Hi Zhang, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on net/master] > Sorry, my fault! I forgot to check my kernel config when building. Thanks, Changzhong > url: https://github.com/intel-lab-lkp/linux/commits/Zhang-Changzhong/net-sonic-use-dma_mapping_error-for-error-check/20221031-204340 > patch link: https://lore.kernel.org/r/1667221322-8317-1-git-send-email-zhangchangzhong%40huawei.com > patch subject: [PATCH net] net/sonic: use dma_mapping_error() for error check > config: mips-jazz_defconfig > compiler: mipsel-linux-gcc (GCC) 12.1.0 > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/intel-lab-lkp/linux/commit/837273d17ba29bbc661c5c82432e83ce4198200a > git remote add linux-review https://github.com/intel-lab-lkp/linux > git fetch --no-tags linux-review Zhang-Changzhong/net-sonic-use-dma_mapping_error-for-error-check/20221031-204340 > git checkout 837273d17ba29bbc661c5c82432e83ce4198200a > # save the config file > mkdir build_dir && cp config build_dir/.config > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot <lkp@intel.com> > > All errors (new ones prefixed by >>): > > In file included from drivers/net/ethernet/natsemi/jazzsonic.c:228: > drivers/net/ethernet/natsemi/sonic.c: In function 'sonic_send_packet': > drivers/net/ethernet/natsemi/sonic.c:295:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation] > 295 | if (dma_mapping_error(lp->device, laddr)) > | ^~ > drivers/net/ethernet/natsemi/sonic.c:297:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' > 297 | dev_kfree_skb_any(skb); > | ^~~~~~~~~~~~~~~~~ > drivers/net/ethernet/natsemi/sonic.c:279:23: warning: unused variable 'flags' [-Wunused-variable] > 279 | unsigned long flags; > | ^~~~~ > drivers/net/ethernet/natsemi/sonic.c:278:13: warning: unused variable 'entry' [-Wunused-variable] > 278 | int entry; > | ^~~~~ > In file included from include/linux/kref.h:16, > from include/linux/mm_types.h:8, > from include/linux/buildid.h:5, > from include/linux/module.h:14, > from drivers/net/ethernet/natsemi/jazzsonic.c:23: > drivers/net/ethernet/natsemi/sonic.c: At top level: > include/linux/spinlock.h:379:1: error: expected identifier or '(' before 'do' > 379 | do { \ > | ^~ > drivers/net/ethernet/natsemi/sonic.c:301:9: note: in expansion of macro 'spin_lock_irqsave' > 301 | spin_lock_irqsave(&lp->lock, flags); > | ^~~~~~~~~~~~~~~~~ > include/linux/spinlock.h:381:3: error: expected identifier or '(' before 'while' > 381 | } while (0) > | ^~~~~ > drivers/net/ethernet/natsemi/sonic.c:301:9: note: in expansion of macro 'spin_lock_irqsave' > 301 | spin_lock_irqsave(&lp->lock, flags); > | ^~~~~~~~~~~~~~~~~ > drivers/net/ethernet/natsemi/sonic.c:303:9: warning: data definition has no type or storage class > 303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; > | ^~~~~ > drivers/net/ethernet/natsemi/sonic.c:303:9: error: type defaults to 'int' in declaration of 'entry' [-Werror=implicit-int] > drivers/net/ethernet/natsemi/sonic.c:303:18: error: 'lp' undeclared here (not in a function); did you mean 'up'? > 303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; > | ^~ > | up > drivers/net/ethernet/natsemi/sonic.c:305:34: error: expected ')' before numeric constant > 305 | sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ > | ^ > | ) > drivers/net/ethernet/natsemi/sonic.c:306:34: error: expected ')' before numeric constant > 306 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */ > | ^ > | ) > drivers/net/ethernet/natsemi/sonic.c:307:34: error: expected ')' before numeric constant > 307 | sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */ > | ^ > | ) > drivers/net/ethernet/natsemi/sonic.c:308:34: error: expected ')' before numeric constant > 308 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_L, laddr & 0xffff); > | ^ > | ) > drivers/net/ethernet/natsemi/sonic.c:309:34: error: expected ')' before numeric constant > 309 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_H, laddr >> 16); > | ^ > | ) > drivers/net/ethernet/natsemi/sonic.c:310:34: error: expected ')' before numeric constant > 310 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_SIZE, length); > | ^ > | ) > drivers/net/ethernet/natsemi/sonic.c:311:34: error: expected ')' before numeric constant > 311 | sonic_tda_put(dev, entry, SONIC_TD_LINK, > | ^ > | ) > drivers/net/ethernet/natsemi/sonic.c:314:30: error: expected ')' before '->' token > 314 | sonic_tda_put(dev, lp->eol_tx, SONIC_TD_LINK, ~SONIC_EOL & > | ^~ > | ) > In file included from include/linux/skbuff.h:45, > from include/net/net_namespace.h:43, > from include/linux/netdevice.h:38, > from drivers/net/ethernet/natsemi/jazzsonic.c:33: > include/net/net_debug.h:123:2: error: expected identifier or '(' before '{' token > 123 | ({ \ > | ^ > drivers/net/ethernet/natsemi/sonic.c:317:9: note: in expansion of macro 'netif_dbg' > 317 | netif_dbg(lp, tx_queued, dev, "%s: issuing Tx command\n", __func__); > | ^~~~~~~~~ >>> drivers/net/ethernet/natsemi/jazzsonic.c:59:1: error: expected identifier or '(' before 'do' > 59 | do { \ > | ^~ > drivers/net/ethernet/natsemi/sonic.c:319:9: note: in expansion of macro 'SONIC_WRITE' > 319 | SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); > | ^~~~~~~~~~~ >>> drivers/net/ethernet/natsemi/jazzsonic.c:61:3: error: expected identifier or '(' before 'while' > 61 | } while (0) > | ^~~~~ > drivers/net/ethernet/natsemi/sonic.c:319:9: note: in expansion of macro 'SONIC_WRITE' > 319 | SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); > | ^~~~~~~~~~~ > drivers/net/ethernet/natsemi/sonic.c:321:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token > 321 | lp->tx_len[entry] = length; > | ^~ > drivers/net/ethernet/natsemi/sonic.c:322:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token > 322 | lp->tx_laddr[entry] = laddr; > | ^~ > drivers/net/ethernet/natsemi/sonic.c:323:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token > 323 | lp->tx_skb[entry] = skb; > | ^~ > drivers/net/ethernet/natsemi/sonic.c:325:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token > 325 | lp->eol_tx = entry; > | ^~ > drivers/net/ethernet/natsemi/sonic.c:327:9: warning: data definition has no type or storage class > 327 | entry = (entry + 1) & SONIC_TDS_MASK; > | ^~~~~ > drivers/net/ethernet/natsemi/sonic.c:327:9: error: type defaults to 'int' in declaration of 'entry' [-Werror=implicit-int] > drivers/net/ethernet/natsemi/sonic.c:327:9: error: redefinition of 'entry' > drivers/net/ethernet/natsemi/sonic.c:303:9: note: previous definition of 'entry' with type 'int' > 303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; > | ^~~~~ > drivers/net/ethernet/natsemi/sonic.c:327:17: error: initializer element is not constant > 327 | entry = (entry + 1) & SONIC_TDS_MASK; > | ^ > drivers/net/ethernet/natsemi/sonic.c:328:9: error: expected identifier or '(' before 'if' > 328 | if (lp->tx_skb[entry]) { > | ^~ > drivers/net/ethernet/natsemi/sonic.c:335:32: error: expected declaration specifiers or '...' before '&' token > 335 | spin_unlock_irqrestore(&lp->lock, flags); > | ^ > drivers/net/ethernet/natsemi/sonic.c:335:43: error: unknown type name 'flags' > 335 | spin_unlock_irqrestore(&lp->lock, flags); > | ^~~~~ > drivers/net/ethernet/natsemi/sonic.c:337:9: error: expected identifier or '(' before 'return' > 337 | return NETDEV_TX_OK; > | ^~~~~~ > drivers/net/ethernet/natsemi/sonic.c:338:1: error: expected identifier or '(' before '}' token > 338 | } > | ^ > cc1: some warnings being treated as errors > > > vim +59 drivers/net/ethernet/natsemi/jazzsonic.c > > ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 57 > ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 58 #define SONIC_WRITE(reg,val) \ > ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 @59 do { \ > efcce839360fb3 drivers/net/jazzsonic.c Finn Thain 2005-08-20 60 *((volatile unsigned int *)dev->base_addr+(reg)) = (val); \ > ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 @61 } while (0) > ^1da177e4c3f41 drivers/net/jazzsonic.c Linus Torvalds 2005-04-16 62 >
Hi Zhang, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on net/master] url: https://github.com/intel-lab-lkp/linux/commits/Zhang-Changzhong/net-sonic-use-dma_mapping_error-for-error-check/20221031-204340 patch link: https://lore.kernel.org/r/1667221322-8317-1-git-send-email-zhangchangzhong%40huawei.com patch subject: [PATCH net] net/sonic: use dma_mapping_error() for error check config: m68k-allyesconfig compiler: m68k-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/837273d17ba29bbc661c5c82432e83ce4198200a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Zhang-Changzhong/net-sonic-use-dma_mapping_error-for-error-check/20221031-204340 git checkout 837273d17ba29bbc661c5c82432e83ce4198200a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/net/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): In file included from drivers/net/ethernet/natsemi/macsonic.c:533: drivers/net/ethernet/natsemi/sonic.c: In function 'sonic_send_packet': >> drivers/net/ethernet/natsemi/sonic.c:295:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation] 295 | if (dma_mapping_error(lp->device, laddr)) | ^~ drivers/net/ethernet/natsemi/sonic.c:297:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 297 | dev_kfree_skb_any(skb); | ^~~~~~~~~~~~~~~~~ drivers/net/ethernet/natsemi/sonic.c:279:23: warning: unused variable 'flags' [-Wunused-variable] 279 | unsigned long flags; | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:278:13: warning: unused variable 'entry' [-Wunused-variable] 278 | int entry; | ^~~~~ In file included from include/linux/kref.h:16, from include/linux/mm_types.h:8, from include/linux/buildid.h:5, from include/linux/module.h:14, from drivers/net/ethernet/natsemi/macsonic.c:36: drivers/net/ethernet/natsemi/sonic.c: At top level: include/linux/spinlock.h:379:1: error: expected identifier or '(' before 'do' 379 | do { \ | ^~ drivers/net/ethernet/natsemi/sonic.c:301:9: note: in expansion of macro 'spin_lock_irqsave' 301 | spin_lock_irqsave(&lp->lock, flags); | ^~~~~~~~~~~~~~~~~ include/linux/spinlock.h:381:3: error: expected identifier or '(' before 'while' 381 | } while (0) | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:301:9: note: in expansion of macro 'spin_lock_irqsave' 301 | spin_lock_irqsave(&lp->lock, flags); | ^~~~~~~~~~~~~~~~~ >> drivers/net/ethernet/natsemi/sonic.c:303:9: warning: data definition has no type or storage class 303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:303:9: error: type defaults to 'int' in declaration of 'entry' [-Werror=implicit-int] drivers/net/ethernet/natsemi/sonic.c:303:18: error: 'lp' undeclared here (not in a function); did you mean 'up'? 303 | entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; | ^~ | up drivers/net/ethernet/natsemi/sonic.c:305:34: error: expected ')' before numeric constant 305 | sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ | ^ | ) drivers/net/ethernet/natsemi/sonic.c:306:34: error: expected ')' before numeric constant 306 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */ | ^ | ) drivers/net/ethernet/natsemi/sonic.c:307:34: error: expected ')' before numeric constant 307 | sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */ | ^ | ) drivers/net/ethernet/natsemi/sonic.c:308:34: error: expected ')' before numeric constant 308 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_L, laddr & 0xffff); | ^ | ) drivers/net/ethernet/natsemi/sonic.c:309:34: error: expected ')' before numeric constant 309 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_H, laddr >> 16); | ^ | ) drivers/net/ethernet/natsemi/sonic.c:310:34: error: expected ')' before numeric constant 310 | sonic_tda_put(dev, entry, SONIC_TD_FRAG_SIZE, length); | ^ | ) drivers/net/ethernet/natsemi/sonic.c:311:34: error: expected ')' before numeric constant 311 | sonic_tda_put(dev, entry, SONIC_TD_LINK, | ^ | ) drivers/net/ethernet/natsemi/sonic.c:314:30: error: expected ')' before '->' token 314 | sonic_tda_put(dev, lp->eol_tx, SONIC_TD_LINK, ~SONIC_EOL & | ^~ | ) In file included from include/linux/skbuff.h:45, from include/net/net_namespace.h:43, from include/linux/netdevice.h:38, from drivers/net/ethernet/natsemi/macsonic.c:47: include/net/net_debug.h:114:1: error: expected identifier or '(' before 'do' 114 | do { \ | ^~ drivers/net/ethernet/natsemi/sonic.c:317:9: note: in expansion of macro 'netif_dbg' 317 | netif_dbg(lp, tx_queued, dev, "%s: issuing Tx command\n", __func__); | ^~~~~~~~~ include/net/net_debug.h:117:3: error: expected identifier or '(' before 'while' 117 | } while (0) | ^~~~~ drivers/net/ethernet/natsemi/sonic.c:317:9: note: in expansion of macro 'netif_dbg' 317 | netif_dbg(lp, tx_queued, dev, "%s: issuing Tx command\n", __func__); | ^~~~~~~~~ In file included from arch/m68k/include/asm/io_mm.h:25, from arch/m68k/include/asm/io.h:8, from include/linux/io.h:13, from include/linux/irq.h:20, from include/asm-generic/hardirq.h:17, from ./arch/m68k/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:11, from include/linux/interrupt.h:11, from drivers/net/ethernet/natsemi/macsonic.c:40: arch/m68k/include/asm/raw_io.h:31:27: error: expected identifier or '(' before 'void' 31 | #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w)) | ^~~~ arch/m68k/include/asm/raw_io.h:44:28: note: in expansion of macro 'out_be16' 44 | #define raw_outw(val,port) out_be16((port),(val)) | ^~~~~~~~ arch/m68k/include/asm/nubus.h:13:22: note: in expansion of macro 'raw_outw' 13 | #define nubus_writew raw_outw | ^~~~~~~~ drivers/net/ethernet/natsemi/macsonic.c:70:31: note: in expansion of macro 'nubus_writew' 70 | #define SONIC_WRITE(reg,val) (nubus_writew(val, dev->base_addr + (reg * 4) \ | ^~~~~~~~~~~~ drivers/net/ethernet/natsemi/sonic.c:319:9: note: in expansion of macro 'SONIC_WRITE' 319 | SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); | ^~~~~~~~~~~ arch/m68k/include/asm/raw_io.h:31:32: error: expected ')' before '(' token 31 | #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w)) | ^ arch/m68k/include/asm/raw_io.h:44:28: note: in expansion of macro 'out_be16' 44 | #define raw_outw(val,port) out_be16((port),(val)) | ^~~~~~~~ arch/m68k/include/asm/nubus.h:13:22: note: in expansion of macro 'raw_outw' 13 | #define nubus_writew raw_outw | ^~~~~~~~ drivers/net/ethernet/natsemi/macsonic.c:70:31: note: in expansion of macro 'nubus_writew' 70 | #define SONIC_WRITE(reg,val) (nubus_writew(val, dev->base_addr + (reg * 4) \ | ^~~~~~~~~~~~ drivers/net/ethernet/natsemi/sonic.c:319:9: note: in expansion of macro 'SONIC_WRITE' 319 | SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); | ^~~~~~~~~~~ drivers/net/ethernet/natsemi/sonic.c:321:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token 321 | lp->tx_len[entry] = length; | ^~ drivers/net/ethernet/natsemi/sonic.c:322:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token 322 | lp->tx_laddr[entry] = laddr; | ^~ vim +/if +295 drivers/net/ethernet/natsemi/sonic.c 254 255 /* 256 * transmit packet 257 * 258 * Appends new TD during transmission thus avoiding any TX interrupts 259 * until we run out of TDs. 260 * This routine interacts closely with the ISR in that it may, 261 * set tx_skb[i] 262 * reset the status flags of the new TD 263 * set and reset EOL flags 264 * stop the tx queue 265 * The ISR interacts with this routine in various ways. It may, 266 * reset tx_skb[i] 267 * test the EOL and status flags of the TDs 268 * wake the tx queue 269 * Concurrently with all of this, the SONIC is potentially writing to 270 * the status flags of the TDs. 271 */ 272 273 static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) 274 { 275 struct sonic_local *lp = netdev_priv(dev); 276 dma_addr_t laddr; 277 int length; 278 int entry; 279 unsigned long flags; 280 281 netif_dbg(lp, tx_queued, dev, "%s: skb=%p\n", __func__, skb); 282 283 length = skb->len; 284 if (length < ETH_ZLEN) { 285 if (skb_padto(skb, ETH_ZLEN)) 286 return NETDEV_TX_OK; 287 length = ETH_ZLEN; 288 } 289 290 /* 291 * Map the packet data into the logical DMA address space 292 */ 293 294 laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE); > 295 if (dma_mapping_error(lp->device, laddr)) 296 pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name); 297 dev_kfree_skb_any(skb); 298 return NETDEV_TX_OK; 299 } 300 301 spin_lock_irqsave(&lp->lock, flags); 302 > 303 entry = (lp->eol_tx + 1) & SONIC_TDS_MASK; 304 305 sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ 306 sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */ 307 sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */ 308 sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_L, laddr & 0xffff); 309 sonic_tda_put(dev, entry, SONIC_TD_FRAG_PTR_H, laddr >> 16); 310 sonic_tda_put(dev, entry, SONIC_TD_FRAG_SIZE, length); 311 sonic_tda_put(dev, entry, SONIC_TD_LINK, 312 sonic_tda_get(dev, entry, SONIC_TD_LINK) | SONIC_EOL); 313 314 sonic_tda_put(dev, lp->eol_tx, SONIC_TD_LINK, ~SONIC_EOL & 315 sonic_tda_get(dev, lp->eol_tx, SONIC_TD_LINK)); 316 317 netif_dbg(lp, tx_queued, dev, "%s: issuing Tx command\n", __func__); 318 319 SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); 320 321 lp->tx_len[entry] = length; 322 lp->tx_laddr[entry] = laddr; 323 lp->tx_skb[entry] = skb; 324 325 lp->eol_tx = entry; 326 327 entry = (entry + 1) & SONIC_TDS_MASK; 328 if (lp->tx_skb[entry]) { 329 /* The ring is full, the ISR has yet to process the next TD. */ 330 netif_dbg(lp, tx_queued, dev, "%s: stopping queue\n", __func__); 331 netif_stop_queue(dev); 332 /* after this packet, wait for ISR to free up some TDAs */ 333 } 334 335 spin_unlock_irqrestore(&lp->lock, flags); 336 337 return NETDEV_TX_OK; 338 } 339
diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c index d17d1b4..4050d5b 100644 --- a/drivers/net/ethernet/natsemi/sonic.c +++ b/drivers/net/ethernet/natsemi/sonic.c @@ -292,7 +292,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) */ laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE); - if (!laddr) { + if (dma_mapping_error(lp->device, laddr)) pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name); dev_kfree_skb_any(skb); return NETDEV_TX_OK; @@ -509,7 +509,7 @@ static bool sonic_alloc_rb(struct net_device *dev, struct sonic_local *lp, *new_addr = dma_map_single(lp->device, skb_put(*new_skb, SONIC_RBSIZE), SONIC_RBSIZE, DMA_FROM_DEVICE); - if (!*new_addr) { + if (dma_mapping_error(lp->device, *new_addr)) { dev_kfree_skb(*new_skb); *new_skb = NULL; return false;