net: hns3: clean up a return in hclge_tm_bp_setup()
Subsystems (5)
PATCH 1/1 net: hns3: clean up a return in hclge_tm_bp_setup()
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.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +1 -1
@@ -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)
Signature · 1 line
2.28.0
Quoted 4 lines · Dan Carpenter
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.
Quoted 20 lines
Signed-off-by Dan Carpenter <[email protected]>--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +1
-1@@ -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)
Quoted 10 lines · Yunsheng Lin
Quoted 4 lines · Dan Carpenter
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
Quoted 6 lines · 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 <[email protected]>
Applied, thanks!