Skip to content

Commit

Permalink
staging: wlags49_h2: Handle sysfs_create_group return correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Kilroy authored and Greg Kroah-Hartman committed Oct 17, 2011
1 parent 8122fa3 commit 1ca6167
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/wlags49_h2/wl_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 10 additions & 8 deletions drivers/staging/wlags49_h2/wl_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 1ca6167

Please sign in to comment.