mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Kilroy <kilroyd@googlemail.com>
To: linux-kernel@vger.kernel.org, greg@kroah.com
Cc: pe1dnn@amsat.org, David Kilroy <kilroyd@googlemail.com>
Subject: [PATCH 1/7] staging: wlags49_h2: Handle sysfs_create_group return correctly
Date: Sun,  9 Oct 2011 12:11:31 +0100	[thread overview]
Message-ID: <1318158697-15979-2-git-send-email-kilroyd@googlemail.com> (raw)
In-Reply-To: <1318158697-15979-1-git-send-email-kilroyd@googlemail.com>

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>
---
 drivers/staging/wlags49_h2/wl_internal.h |    2 +-
 drivers/staging/wlags49_h2/wl_sysfs.c    |   18 ++++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wlags49_h2/wl_internal.h b/drivers/staging/wlags49_h2/wl_internal.h
index 6351bb8..9ed2857 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 9b833b3..1508f04 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);
 }
-- 
1.7.4.1


  reply	other threads:[~2011-10-09 11:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-09 11:11 [PATCH 0/7] Enable WPA with wlags49_h2 David Kilroy
2011-10-09 11:11 ` David Kilroy [this message]
2011-10-09 11:11 ` [PATCH 2/7] staging: wlags49_h2: Enable WPA in the HCF David Kilroy
2011-10-09 11:11 ` [PATCH 4/7] staging: wlags49_h2: Report WPA IE in scan results with IWEVGENIE David Kilroy
2011-10-09 11:11 ` [PATCH 5/7] staging: wlags49_h2: Make key setting more reliable David Kilroy
2011-10-09 11:11 ` [PATCH 6/7] staging: wlags49_h2: Fixup IW_AUTH handling David Kilroy
2011-10-09 11:11 ` [PATCH 7/7] staging: wlags49_h2: Fixup SIOCSIWGENIE David Kilroy
     [not found] ` <1318158697-15979-4-git-send-email-kilroyd@googlemail.com>
2011-10-09 11:26   ` [PATCH 3/7] staging: wlags49_h2: Remove useless IWE_STREAM_ADD_YYY defines Dave Kilroy
2011-10-09 16:54     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318158697-15979-2-git-send-email-kilroyd@googlemail.com \
    --to=kilroyd@googlemail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pe1dnn@amsat.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome