summaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_sysfs.c
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2008-05-02 13:00:30 -0500
committerJeff Garzik <jgarzik@redhat.com>2008-05-06 12:01:34 -0400
commitf162b9d58273a9a5747211133c8ccb2de5cf5ff2 (patch)
tree1ee677ebfe4cc3ecf4e2b9deffda26a264c1426c /drivers/net/gianfar_sysfs.c
parent569f0c4d909c7f73de634abcdc36344cb72de36a (diff)
downloadop-kernel-dev-f162b9d58273a9a5747211133c8ccb2de5cf5ff2.zip
op-kernel-dev-f162b9d58273a9a5747211133c8ccb2de5cf5ff2.tar.gz
gianfar: Fix a locking bug in gianfar's sysfs code
During sparse cleanup, found a locking bug. Some of the sysfs functions were acquiring a lock, and then returning in the event of an error. We rearrange the code so that the lock is released in error conditions, too. Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/gianfar_sysfs.c')
-rw-r--r--drivers/net/gianfar_sysfs.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c
index 230878b..5116f68 100644
--- a/drivers/net/gianfar_sysfs.c
+++ b/drivers/net/gianfar_sysfs.c
@@ -103,10 +103,10 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev,
spin_lock_irqsave(&priv->rxlock, flags);
if (length > priv->rx_buffer_size)
- return count;
+ goto out;
if (length == priv->rx_stash_size)
- return count;
+ goto out;
priv->rx_stash_size = length;
@@ -125,6 +125,7 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev,
gfar_write(&priv->regs->attr, temp);
+out:
spin_unlock_irqrestore(&priv->rxlock, flags);
return count;
@@ -154,10 +155,10 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev,
spin_lock_irqsave(&priv->rxlock, flags);
if (index > priv->rx_stash_size)
- return count;
+ goto out;
if (index == priv->rx_stash_index)
- return count;
+ goto out;
priv->rx_stash_index = index;
@@ -166,6 +167,7 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev,
temp |= ATTRELI_EI(index);
gfar_write(&priv->regs->attreli, flags);
+out:
spin_unlock_irqrestore(&priv->rxlock, flags);
return count;
OpenPOWER on IntegriCloud