* [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup()
@ 2020-10-23 11:22 Dan Carpenter
2020-10-26 3:18 ` Yunsheng Lin
2020-10-26 23:17 ` Jakub Kicinski
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-10-23 11:22 UTC (permalink / raw)
To: Yisen Zhuang
Cc: Salil Mehta, David S. Miller, Jakub Kicinski, Huazhong Tan,
Yonglong Liu, Yufeng Mo, Pankaj Bharadiya, Guangbin Huang,
netdev, linux-kernel, kernel-janitors
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.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
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)
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup()
2020-10-23 11:22 [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup() Dan Carpenter
@ 2020-10-26 3:18 ` Yunsheng Lin
2020-10-26 6:52 ` Dan Carpenter
2020-10-26 23:17 ` Jakub Kicinski
1 sibling, 1 reply; 4+ messages in thread
From: Yunsheng Lin @ 2020-10-26 3:18 UTC (permalink / raw)
To: Dan Carpenter, Yisen Zhuang
Cc: Salil Mehta, David S. Miller, Jakub Kicinski, Huazhong Tan,
Yonglong Liu, Yufeng Mo, Pankaj Bharadiya, Guangbin Huang,
netdev, linux-kernel, kernel-janitors
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 <dan.carpenter@oracle.com>
> ---
> 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)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup()
2020-10-26 3:18 ` Yunsheng Lin
@ 2020-10-26 6:52 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-10-26 6:52 UTC (permalink / raw)
To: Yunsheng Lin
Cc: Yisen Zhuang, Salil Mehta, David S. Miller, Jakub Kicinski,
Huazhong Tan, Yonglong Liu, Yufeng Mo, Pankaj Bharadiya,
Guangbin Huang, netdev, linux-kernel, kernel-janitors
On Mon, Oct 26, 2020 at 11:18:16AM +0800, Yunsheng Lin wrote:
> 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.
>
It's not really normal to limit ret scope... I think it's better to
leave it as-is.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup()
2020-10-23 11:22 [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup() Dan Carpenter
2020-10-26 3:18 ` Yunsheng Lin
@ 2020-10-26 23:17 ` Jakub Kicinski
1 sibling, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2020-10-26 23:17 UTC (permalink / raw)
To: Dan Carpenter
Cc: Yisen Zhuang, Salil Mehta, David S. Miller, Huazhong Tan,
Yonglong Liu, Yufeng Mo, Pankaj Bharadiya, Guangbin Huang,
netdev, linux-kernel, kernel-janitors
On Fri, 23 Oct 2020 14:22:12 +0300 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-26 23:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23 11:22 [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup() Dan Carpenter
2020-10-26 3:18 ` Yunsheng Lin
2020-10-26 6:52 ` Dan Carpenter
2020-10-26 23:17 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).