From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AA45C43381 for ; Tue, 19 Feb 2019 02:34:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03F222085A for ; Tue, 19 Feb 2019 02:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726447AbfBSCeL (ORCPT ); Mon, 18 Feb 2019 21:34:11 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:45708 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725852AbfBSCeL (ORCPT ); Mon, 18 Feb 2019 21:34:11 -0500 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id BAA18430DFF35E26AFCC; Tue, 19 Feb 2019 10:34:08 +0800 (CST) Received: from [127.0.0.1] (10.177.31.96) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.408.0; Tue, 19 Feb 2019 10:34:05 +0800 Subject: Re: [PATCH net-next] yellowfin: fix remove set but not used variable warning To: David Miller References: <20190218081546.189509-1-yuehaibing@huawei.com> <20190218.121337.147896114474592034.davem@davemloft.net> CC: , , From: YueHaibing Message-ID: <6a7fe3d5-9532-c1fb-764a-2e12f98ee914@huawei.com> Date: Tue, 19 Feb 2019 10:34:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20190218.121337.147896114474592034.davem@davemloft.net> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2019/2/19 4:13, David Miller wrote: > From: YueHaibing > Date: Mon, 18 Feb 2019 08:15:46 +0000 > >> @@ -1050,8 +1050,11 @@ static int yellowfin_rx(struct net_device *dev) >> struct sk_buff *rx_skb = yp->rx_skbuff[entry]; >> s16 frame_status; >> u16 desc_status; >> - int data_size, yf_size; >> + int data_size; >> u8 *buf_addr; >> +#ifdef YF_PROTOTYPE >> + int yf_size = sizeof(struct yellowfin_desc); >> +#endif > > This is just silly. > > Please move this variable declaration and initialization into the > YF_PROTOTYPE basic block in the code below it, like this: > > #ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */ > } else if ((yp->flags & HasMACAddrBug) && > int yf_size = sizeof(struct yellowfin_desc); There's just in if condition, define the 'yf_size' seems incorrect maybe we can remove 'yf_size' and use sizeof directly? > > !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma + > entry * yf_size), > dev->dev_addr) && > !ether_addr_equal(le32_to_cpu(yp->rx_ring_dma + > entry * yf_size), > "\377\377\377\377\377\377")) { > if (bogus_rx++ == 0) > netdev_warn(dev, "Bad frame to %pM\n", > buf_addr); > #endif > > Thanks. > > . >