From: David Kilroy Date: Sun, 9 Oct 2011 11:11:31 +0000 (+0100) Subject: staging: wlags49_h2: Handle sysfs_create_group return correctly X-Git-Tag: firefly_0821_release~3680^2~4313^2^2~77 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1ca616711c830681faa04d5bbdaccc290a910110;p=firefly-linux-kernel-4.4.55.git staging: wlags49_h2: Handle sysfs_create_group return correctly 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wlags49_h2/wl_internal.h b/drivers/staging/wlags49_h2/wl_internal.h index 6351bb8b680b..9ed28574e8a9 100644 --- a/drivers/staging/wlags49_h2/wl_internal.h +++ b/drivers/staging/wlags49_h2/wl_internal.h @@ -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; diff --git a/drivers/staging/wlags49_h2/wl_sysfs.c b/drivers/staging/wlags49_h2/wl_sysfs.c index 9b833b30ae62..1508f04b3c6f 100644 --- a/drivers/staging/wlags49_h2/wl_sysfs.c +++ b/drivers/staging/wlags49_h2/wl_sysfs.c @@ -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); }