Re: [PATCH 2/2] staging: qlge: fix else after return or break

From: Coiby Xu
Date: Fri Jun 26 2020 - 07:47:43 EST


On Thu, Jun 25, 2020 at 03:13:14PM -0700, Joe Perches wrote:
On Fri, 2020-06-26 at 05:57 +0800, Coiby Xu wrote:
Remove unnecessary elses after return or break.

unrelated trivia:

diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
[]
@@ -1391,12 +1391,11 @@ static void ql_dump_cam_entries(struct ql_adapter *qdev)
pr_err("%s: Failed read of mac index register\n",
__func__);
return;
- } else {
- if (value[0])
- pr_err("%s: CAM index %d CAM Lookup Lower = 0x%.08x:%.08x, Output = 0x%.08x\n",
- qdev->ndev->name, i, value[1], value[0],
- value[2]);

looks like all of these could use netdev_err

netdev_err(qdev, "etc...",
i, value[1], value[0], value[2]);

etc...

Interestingly, scripts/checkpatch.pl couldn't detect this problem.
I once used printk(KERN_ALERT...) and the script would properly warn me
that,

WARNING: Prefer [subsystem eg: netdev]_alert([subsystem]dev, ... then dev_alert(dev, ... then pr_alert(... to printk(KERN_ALERT .

I'll fix this issue when sending another version of the patches. Thank
you for the reminding!

--
Best regards,
Coiby