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=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 BED8EC5517A for ; Mon, 26 Oct 2020 03:17:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7AEA620658 for ; Mon, 26 Oct 2020 03:17:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1421846AbgJZDRW (ORCPT ); Sun, 25 Oct 2020 23:17:22 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2570 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1421836AbgJZDRW (ORCPT ); Sun, 25 Oct 2020 23:17:22 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CKKl929fXzhZ6n; Mon, 26 Oct 2020 11:17:25 +0800 (CST) Received: from [10.74.191.121] (10.74.191.121) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Mon, 26 Oct 2020 11:17:09 +0800 Subject: Re: [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup() To: Dan Carpenter , Yisen Zhuang CC: Salil Mehta , "David S. Miller" , Jakub Kicinski , Huazhong Tan , Yonglong Liu , Yufeng Mo , Pankaj Bharadiya , Guangbin Huang , , , References: <20201023112212.GA282278@mwanda> From: Yunsheng Lin Message-ID: <3fbcbfbd-deea-162e-9281-29e65b90996b@huawei.com> Date: Mon, 26 Oct 2020 11:18:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20201023112212.GA282278@mwanda> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.191.121] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2020/10/23 19:22, Dan Carpenter wrote: > Smatch complains that "ret" might be uninitialized if we don't enter > the loop. We do always enter the loop so it's a false positive, but > it's cleaner to just return a literal zero and that silences the > warning as well. Thanks for the clean up. Minor comment below: Perhap it makes sense to limit ret scope within the for loop after returning zero. > > Signed-off-by: Dan Carpenter > --- > drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c > index 15f69fa86323..e8495f58a1a8 100644 > --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c > +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c > @@ -1373,7 +1373,7 @@ static int hclge_tm_bp_setup(struct hclge_dev *hdev) > return ret; > } > > - return ret; > + return 0; > } > > int hclge_pause_setup_hw(struct hclge_dev *hdev, bool init) >