Skip to content

Commit

Permalink
drivers/net/wireless/ipw2100.c: Release mutex in error handling code
Browse files Browse the repository at this point in the history
The mutex is released on a successful return, so it would seem that it
should be released on an error return as well.

The semantic patch finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression l;
@@

mutex_lock(l);
... when != mutex_unlock(l)
    when any
    when strict
(
if (...) { ... when != mutex_unlock(l)
+   mutex_unlock(l);
    return ...;
}
|
mutex_unlock(l);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Julia Lawall authored and John W. Linville committed Jul 29, 2008
1 parent e7087a8 commit 80c42af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/ipw2100.c
Original file line number Diff line number Diff line change
Expand Up @@ -6442,6 +6442,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
if (err) {
printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
dev->name);
mutex_unlock(&priv->action_mutex);
return err;
}
pci_restore_state(pci_dev);
Expand Down Expand Up @@ -7146,7 +7147,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev,
err = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &val, &len);
if (err) {
IPW_DEBUG_WX("failed querying ordinals.\n");
return err;
goto done;
}

switch (val & TX_RATE_MASK) {
Expand Down

0 comments on commit 80c42af

Please sign in to comment.