Re: [PATCH 2/2] staging: qlge: fix else after return or break
From: Dan Carpenter
Date: Fri Jun 26 2020 - 04:34:54 EST
On Fri, Jun 26, 2020 at 05:57:55AM +0800, Coiby Xu wrote:
> @@ -1404,11 +1403,10 @@ 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: MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x\n",
> - qdev->ndev->name, i, value[1], value[0]);
> }
> + if (value[0])
> + pr_err("%s: MCAST index %d CAM Lookup Lower = 0x%.08x:%.08x\n",
> + qdev->ndev->name, i, value[1], value[0]);
> }
> ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }
> @@ -1427,11 +1425,10 @@ void ql_dump_routing_entries(struct ql_adapter *qdev)
> pr_err("%s: Failed read of routing index register\n",
> __func__);
> return;
^^^^^^
> - } else {
> - if (value)
> - pr_err("%s: Routing Mask %d = 0x%.08x\n",
> - qdev->ndev->name, i, value);
> }
> + if (value)
> + pr_err("%s: Routing Mask %d = 0x%.08x\n",
> + qdev->ndev->name, i, value);
> }
> ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> }
This is not caused by your patch, but in these two functions we return
without dropping the lock. There may be other places as well, but these
are the two I can see without leaving my email client.
Do you think you could fix that before we forget? Just change the
return to a break to fix the bug.
regards,
dan carpenter