net/qla3xxx: fix an error code in ql_adapter_up()
PATCH v2 1/1 net/qla3xxx: fix an error code in ql_adapter_up()
The ql_wait_for_drvr_lock() fails and returns false, then this function should return an error code instead of returning success.
The other problem is that the success path prints an error message netdev_err(ndev, "Releasing driver lock\n"); Delete that and re-order the code a little to make it more clear.
---
v2: fix the subject and Fixes tag. Delete the bogus error message.
drivers/net/ethernet/qlogic/qla3xxx.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/net/ethernet/qlogic/qla3xxx.c +9 -10
@@ -3480,20 +3480,19 @@ static int ql_adapter_up(struct ql3_adapter *qdev)spin_lock_irqsave (&qdev->hw_lock, hw_flags); - err =ql_wait_for_drvr_lock (qdev); -if (err) { - err =ql_adapter_initialize (qdev); -if (err) { -netdev_err (ndev,"Unable to initialize adapter\n" ); - goto err_init; - } -netdev_err (ndev,"Releasing driver lock\n" ); -ql_sem_unlock (qdev,QL_DRVR_SEM_MASK ); - }else { +if (!ql_wait_for_drvr_lock (qdev)) {netdev_err (ndev,"Could not acquire driver lock\n" ); + err = -ENODEV ; goto err_lock; } + err =ql_adapter_initialize (qdev); +if (err) { +netdev_err (ndev,"Unable to initialize adapter\n" ); + goto err_init; + } +ql_sem_unlock (qdev,QL_DRVR_SEM_MASK ); +spin_unlock_irqrestore (&qdev->hw_lock, hw_flags);set_bit (QL_ADAPTER_UP , &qdev->flags);
Signature · 1 line
2.20.1
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 7 Dec 2021 11:24:16 +0300 you wrote:
The
ql_wait_for_drvr_lock()fails and returns false, then this function should return an error code instead of returning success.The other problem is that the success path prints an error message
netdev_err(ndev, "Releasing driver lock\n"); Delete that and re-order the code a little to make it more clear.[...]
Here is the summary with links:
- [net,v2] net/qla3xxx: fix an error code in ql_adapter_up()
https://git.kernel.org/netdev/net/c/d17b9737c2bc
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html