staging: wlags49_h2: Handle sysfs_create_group return correctly
authorDavid Kilroy <kilroyd@googlemail.com>
Sun, 9 Oct 2011 11:11:31 +0000 (12:11 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 17 Oct 2011 22:22:36 +0000 (15:22 -0700)
The function returns 0 on success and non-zero on error. So
correctly record the status so it is freed appropriately.

Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/wlags49_h2/wl_internal.h
drivers/staging/wlags49_h2/wl_sysfs.c

index 6351bb8b680bdb70bf579fd9a08bd9f914fd70ca..9ed28574e8a9ae88aa54b04c3ea2da58a55d2985 100644 (file)
@@ -883,7 +883,7 @@ struct wl_private
        int                         is_registered;
        int                         is_handling_int;
        int                         firmware_present;
-       char                        sysfsCreated;
+       bool                        sysfsCreated;
        CFG_DRV_INFO_STRCT          driverInfo;
        CFG_IDENTITY_STRCT          driverIdentity;
        CFG_FW_IDENTITY_STRCT       StationIdentity;
index 9b833b30ae6250de88766c86bd38c79b59906600..1508f04b3c6f58a18e7af8c3fe7df519090aa7d3 100644 (file)
@@ -120,17 +120,19 @@ static struct attribute_group wlags_group = {
 
 void register_wlags_sysfs(struct net_device *net)
 {
-    struct device *dev = &(net->dev);
-    struct wl_private *lp = wl_priv(net);
-
-    lp->sysfsCreated = sysfs_create_group(&dev->kobj, &wlags_group);
+       struct device *dev = &(net->dev);
+       struct wl_private *lp = wl_priv(net);
+       int err;
+       err = sysfs_create_group(&dev->kobj, &wlags_group);
+       if (!err)
+               lp->sysfsCreated = true;
 }
 
 void unregister_wlags_sysfs(struct net_device *net)
 {
-    struct device *dev = &(net->dev);
-    struct wl_private *lp = wl_priv(net);
+       struct device *dev = &(net->dev);
+       struct wl_private *lp = wl_priv(net);
 
-    if (lp->sysfsCreated)
-       sysfs_remove_group(&dev->kobj, &wlags_group);
+       if (lp->sysfsCreated)
+               sysfs_remove_group(&dev->kobj, &wlags_group);
 }