All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, jt@hpl.hp.com
Subject: [PATCH 8/9] wext: misc code cleanups
Date: Tue, 24 Apr 2007 20:07:40 +0200	[thread overview]
Message-ID: <20070424180850.362164000@sipsolutions.net> (raw)
In-Reply-To: 20070424180732.371620000@sipsolutions.net

Just a few things that didn't fit in with the other patches.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
 net/wireless/wext.c |   28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

--- net-2.6.22.orig/net/wireless/wext.c	2007-04-24 19:18:49.198804911 +0200
+++ net-2.6.22/net/wireless/wext.c	2007-04-24 19:25:46.768804911 +0200
@@ -476,7 +476,7 @@ static struct iw_statistics *get_wireles
 		return dev->wireless_handlers->get_wireless_stats(dev);
 
 	/* Not found */
-	return (struct iw_statistics *) NULL;
+	return NULL;
 }
 
 /* ---------------------------------------------------------------- */
@@ -501,11 +501,11 @@ static struct iw_statistics *get_wireles
 static int call_commit_handler(struct net_device *dev)
 {
 	if ((netif_running(dev)) &&
-	   (dev->wireless_handlers->standard[0] != NULL)) {
+	   (dev->wireless_handlers->standard[0] != NULL))
 		/* Call the commit handler on the driver */
 		return dev->wireless_handlers->standard[0](dev, NULL,
 							   NULL, NULL);
-	} else
+	else
 		return 0;		/* Command completed successfully */
 }
 
@@ -554,8 +554,7 @@ static int iw_handler_get_iwstats(struct
 	struct iw_statistics *stats;
 
 	stats = get_wireless_stats(dev);
-	if (stats != (struct iw_statistics *) NULL) {
-
+	if (stats) {
 		/* Copy statistics to extra */
 		memcpy(extra, stats, sizeof(struct iw_statistics));
 		wrqu->data.length = sizeof(struct iw_statistics);
@@ -814,9 +813,8 @@ static int ioctl_standard_call(struct ne
 		/* Create the kernel buffer */
 		/*    kzalloc ensures NULL-termination for essid_compat */
 		extra = kzalloc(extra_size, GFP_KERNEL);
-		if (extra == NULL) {
+		if (extra == NULL)
 			return -ENOMEM;
-		}
 
 		/* If it is a SET, get all the extra data in here */
 		if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
@@ -957,18 +955,14 @@ static int ioctl_private_call(struct net
 			if (iwr->u.data.length > (descr->set_args &
 						 IW_PRIV_SIZE_MASK))
 				return -E2BIG;
-		} else {
-			/* Check NULL pointer */
-			if (iwr->u.data.pointer == NULL)
-				return -EFAULT;
-		}
+		} else if (iwr->u.data.pointer == NULL)
+			return -EFAULT;
 
 		/* Always allocate for max space. Easier, and won't last
 		 * long... */
 		extra = kmalloc(extra_size, GFP_KERNEL);
-		if (extra == NULL) {
+		if (extra == NULL)
 			return -ENOMEM;
-		}
 
 		/* If it is a SET, get all the extra data in here */
 		if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
@@ -1259,7 +1253,7 @@ void wireless_send_event(struct net_devi
 	event->len = event_len;
 	event->cmd = cmd;
 	memcpy(&event->u, ((char *) wrqu) + wrqu_off, hdr_len - IW_EV_LCP_LEN);
-	if (extra != NULL)
+	if (extra)
 		memcpy(((char *) event) + hdr_len, extra, extra_len);
 
 	/* Send via the RtNetlink event channel */
@@ -1290,11 +1284,11 @@ EXPORT_SYMBOL(wireless_send_event);
  * Because this is called on the Rx path via wireless_spy_update(),
  * we want it to be efficient...
  */
-static inline struct iw_spy_data * get_spydata(struct net_device *dev)
+static inline struct iw_spy_data *get_spydata(struct net_device *dev)
 {
 	/* This is the new way */
 	if (dev->wireless_data)
-		return(dev->wireless_data->spy_data);
+		return dev->wireless_data->spy_data;
 	return NULL;
 }
 

--


WARNING: multiple messages have this Message-ID (diff)
From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
To: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jt-sDzT885Ts8HQT0dZR+AlfA@public.gmane.org
Subject: [PATCH 8/9] wext: misc code cleanups
Date: Tue, 24 Apr 2007 20:07:40 +0200	[thread overview]
Message-ID: <20070424180850.362164000@sipsolutions.net> (raw)
In-Reply-To: 20070424180732.371620000@sipsolutions.net

[-- Attachment #1: wext-misc.patch --]
[-- Type: text/plain, Size: 3279 bytes --]

Just a few things that didn't fit in with the other patches.

Signed-off-by: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>

---
 net/wireless/wext.c |   28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

--- net-2.6.22.orig/net/wireless/wext.c	2007-04-24 19:18:49.198804911 +0200
+++ net-2.6.22/net/wireless/wext.c	2007-04-24 19:25:46.768804911 +0200
@@ -476,7 +476,7 @@ static struct iw_statistics *get_wireles
 		return dev->wireless_handlers->get_wireless_stats(dev);
 
 	/* Not found */
-	return (struct iw_statistics *) NULL;
+	return NULL;
 }
 
 /* ---------------------------------------------------------------- */
@@ -501,11 +501,11 @@ static struct iw_statistics *get_wireles
 static int call_commit_handler(struct net_device *dev)
 {
 	if ((netif_running(dev)) &&
-	   (dev->wireless_handlers->standard[0] != NULL)) {
+	   (dev->wireless_handlers->standard[0] != NULL))
 		/* Call the commit handler on the driver */
 		return dev->wireless_handlers->standard[0](dev, NULL,
 							   NULL, NULL);
-	} else
+	else
 		return 0;		/* Command completed successfully */
 }
 
@@ -554,8 +554,7 @@ static int iw_handler_get_iwstats(struct
 	struct iw_statistics *stats;
 
 	stats = get_wireless_stats(dev);
-	if (stats != (struct iw_statistics *) NULL) {
-
+	if (stats) {
 		/* Copy statistics to extra */
 		memcpy(extra, stats, sizeof(struct iw_statistics));
 		wrqu->data.length = sizeof(struct iw_statistics);
@@ -814,9 +813,8 @@ static int ioctl_standard_call(struct ne
 		/* Create the kernel buffer */
 		/*    kzalloc ensures NULL-termination for essid_compat */
 		extra = kzalloc(extra_size, GFP_KERNEL);
-		if (extra == NULL) {
+		if (extra == NULL)
 			return -ENOMEM;
-		}
 
 		/* If it is a SET, get all the extra data in here */
 		if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
@@ -957,18 +955,14 @@ static int ioctl_private_call(struct net
 			if (iwr->u.data.length > (descr->set_args &
 						 IW_PRIV_SIZE_MASK))
 				return -E2BIG;
-		} else {
-			/* Check NULL pointer */
-			if (iwr->u.data.pointer == NULL)
-				return -EFAULT;
-		}
+		} else if (iwr->u.data.pointer == NULL)
+			return -EFAULT;
 
 		/* Always allocate for max space. Easier, and won't last
 		 * long... */
 		extra = kmalloc(extra_size, GFP_KERNEL);
-		if (extra == NULL) {
+		if (extra == NULL)
 			return -ENOMEM;
-		}
 
 		/* If it is a SET, get all the extra data in here */
 		if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) {
@@ -1259,7 +1253,7 @@ void wireless_send_event(struct net_devi
 	event->len = event_len;
 	event->cmd = cmd;
 	memcpy(&event->u, ((char *) wrqu) + wrqu_off, hdr_len - IW_EV_LCP_LEN);
-	if (extra != NULL)
+	if (extra)
 		memcpy(((char *) event) + hdr_len, extra, extra_len);
 
 	/* Send via the RtNetlink event channel */
@@ -1290,11 +1284,11 @@ EXPORT_SYMBOL(wireless_send_event);
  * Because this is called on the Rx path via wireless_spy_update(),
  * we want it to be efficient...
  */
-static inline struct iw_spy_data * get_spydata(struct net_device *dev)
+static inline struct iw_spy_data *get_spydata(struct net_device *dev)
 {
 	/* This is the new way */
 	if (dev->wireless_data)
-		return(dev->wireless_data->spy_data);
+		return dev->wireless_data->spy_data;
 	return NULL;
 }
 

--

  parent reply	other threads:[~2007-04-26  9:40 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-24 18:07 [PATCH 0/9] various wext cleanups Johannes Berg
2007-04-24 18:07 ` [PATCH 1/9] wext: move to net/wireless Johannes Berg
2007-04-24 18:07 ` [PATCH 2/9] wext: clean up how wext is called Johannes Berg
2007-04-24 18:07   ` Johannes Berg
2007-04-24 18:07 ` [PATCH 3/9] wext: remove dead debug code Johannes Berg
2007-04-24 18:07   ` Johannes Berg
2007-04-26 16:46   ` Jean Tourrilhes
2007-04-26 16:46     ` Jean Tourrilhes
2007-04-27  0:55     ` John W. Linville
2007-04-27  0:55       ` John W. Linville
2007-04-24 18:07 ` [PATCH 4/9] wext: remove options Johannes Berg
2007-04-24 18:07   ` Johannes Berg
2007-04-24 18:07 ` [PATCH 5/9] wext: cleanup early ioctl call path Johannes Berg
2007-04-24 18:07   ` Johannes Berg
2007-04-24 18:07 ` [PATCH 6/9] wext: move EXPORT_SYMBOL statements where they belong Johannes Berg
2007-04-24 18:07   ` Johannes Berg
2007-04-24 18:07 ` [PATCH 7/9] wext: reduce inline abuse Johannes Berg
2007-04-24 18:07   ` Johannes Berg
2007-04-26 16:50   ` Jean Tourrilhes
2007-04-26 17:03     ` Michael Buesch
2007-04-26 17:15       ` Jean Tourrilhes
2007-04-26 17:15         ` Jean Tourrilhes
2007-04-26 21:37         ` David Miller
2007-04-26 17:14     ` Johannes Berg
2007-04-26 17:14       ` Johannes Berg
2007-04-24 18:07 ` Johannes Berg [this message]
2007-04-24 18:07   ` [PATCH 8/9] wext: misc code cleanups Johannes Berg
2007-04-24 18:07 ` [PATCH 9/9] net_device: dont include wext bits if not required Johannes Berg
2007-04-24 18:07   ` Johannes Berg
2007-04-26 16:53   ` Jean Tourrilhes
2007-04-26 16:53     ` Jean Tourrilhes
2007-04-26 17:08     ` Johannes Berg
2007-04-27  0:50     ` John W. Linville
2007-04-27  0:50       ` John W. Linville
2007-04-26 10:15 ` [PATCH 0/9] various wext cleanups Johannes Berg
2007-04-26 10:15   ` Johannes Berg
2007-04-26 10:18   ` David Miller
2007-04-26 11:05     ` Johannes Berg
2007-04-26 11:05       ` Johannes Berg
2007-04-26 10:19 ` David Miller
2007-04-26 10:19   ` David Miller
2007-04-27  1:12   ` John W. Linville
2007-04-27  1:12     ` John W. Linville
2007-04-27  2:36     ` David Miller
2007-04-27  3:48 ` David Miller

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=20070424180850.362164000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=davem@davemloft.net \
    --cc=jt@hpl.hp.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.