diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-04-26 23:47:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-04-26 23:47:25 -0400 |
commit | 4d44e0dfe961e02489d40d32334454ebe0e784e8 (patch) | |
tree | 8830eb99b6bdc9e5ef454c876254dc1dc77062f4 /net | |
parent | bdf51894c1d7ce3fba8c8fdf485e85173ac60c6c (diff) |
[WEXT]: Misc code cleanups.
Just a few things that didn't fit in with the other patches.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/wireless/wext.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/net/wireless/wext.c b/net/wireless/wext.c index f733303f4bde..d6aaf65192e9 100644 --- a/net/wireless/wext.c +++ b/net/wireless/wext.c | |||
@@ -476,7 +476,7 @@ static struct iw_statistics *get_wireless_stats(struct net_device *dev) | |||
476 | return dev->wireless_handlers->get_wireless_stats(dev); | 476 | return dev->wireless_handlers->get_wireless_stats(dev); |
477 | 477 | ||
478 | /* Not found */ | 478 | /* Not found */ |
479 | return (struct iw_statistics *) NULL; | 479 | return NULL; |
480 | } | 480 | } |
481 | 481 | ||
482 | /* ---------------------------------------------------------------- */ | 482 | /* ---------------------------------------------------------------- */ |
@@ -501,11 +501,11 @@ static struct iw_statistics *get_wireless_stats(struct net_device *dev) | |||
501 | static int call_commit_handler(struct net_device *dev) | 501 | static int call_commit_handler(struct net_device *dev) |
502 | { | 502 | { |
503 | if ((netif_running(dev)) && | 503 | if ((netif_running(dev)) && |
504 | (dev->wireless_handlers->standard[0] != NULL)) { | 504 | (dev->wireless_handlers->standard[0] != NULL)) |
505 | /* Call the commit handler on the driver */ | 505 | /* Call the commit handler on the driver */ |
506 | return dev->wireless_handlers->standard[0](dev, NULL, | 506 | return dev->wireless_handlers->standard[0](dev, NULL, |
507 | NULL, NULL); | 507 | NULL, NULL); |
508 | } else | 508 | else |
509 | return 0; /* Command completed successfully */ | 509 | return 0; /* Command completed successfully */ |
510 | } | 510 | } |
511 | 511 | ||
@@ -554,8 +554,7 @@ static int iw_handler_get_iwstats(struct net_device * dev, | |||
554 | struct iw_statistics *stats; | 554 | struct iw_statistics *stats; |
555 | 555 | ||
556 | stats = get_wireless_stats(dev); | 556 | stats = get_wireless_stats(dev); |
557 | if (stats != (struct iw_statistics *) NULL) { | 557 | if (stats) { |
558 | |||
559 | /* Copy statistics to extra */ | 558 | /* Copy statistics to extra */ |
560 | memcpy(extra, stats, sizeof(struct iw_statistics)); | 559 | memcpy(extra, stats, sizeof(struct iw_statistics)); |
561 | wrqu->data.length = sizeof(struct iw_statistics); | 560 | wrqu->data.length = sizeof(struct iw_statistics); |
@@ -814,9 +813,8 @@ static int ioctl_standard_call(struct net_device * dev, | |||
814 | /* Create the kernel buffer */ | 813 | /* Create the kernel buffer */ |
815 | /* kzalloc ensures NULL-termination for essid_compat */ | 814 | /* kzalloc ensures NULL-termination for essid_compat */ |
816 | extra = kzalloc(extra_size, GFP_KERNEL); | 815 | extra = kzalloc(extra_size, GFP_KERNEL); |
817 | if (extra == NULL) { | 816 | if (extra == NULL) |
818 | return -ENOMEM; | 817 | return -ENOMEM; |
819 | } | ||
820 | 818 | ||
821 | /* If it is a SET, get all the extra data in here */ | 819 | /* If it is a SET, get all the extra data in here */ |
822 | if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) { | 820 | if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) { |
@@ -957,18 +955,14 @@ static int ioctl_private_call(struct net_device *dev, struct ifreq *ifr, | |||
957 | if (iwr->u.data.length > (descr->set_args & | 955 | if (iwr->u.data.length > (descr->set_args & |
958 | IW_PRIV_SIZE_MASK)) | 956 | IW_PRIV_SIZE_MASK)) |
959 | return -E2BIG; | 957 | return -E2BIG; |
960 | } else { | 958 | } else if (iwr->u.data.pointer == NULL) |
961 | /* Check NULL pointer */ | 959 | return -EFAULT; |
962 | if (iwr->u.data.pointer == NULL) | ||
963 | return -EFAULT; | ||
964 | } | ||
965 | 960 | ||
966 | /* Always allocate for max space. Easier, and won't last | 961 | /* Always allocate for max space. Easier, and won't last |
967 | * long... */ | 962 | * long... */ |
968 | extra = kmalloc(extra_size, GFP_KERNEL); | 963 | extra = kmalloc(extra_size, GFP_KERNEL); |
969 | if (extra == NULL) { | 964 | if (extra == NULL) |
970 | return -ENOMEM; | 965 | return -ENOMEM; |
971 | } | ||
972 | 966 | ||
973 | /* If it is a SET, get all the extra data in here */ | 967 | /* If it is a SET, get all the extra data in here */ |
974 | if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) { | 968 | if (IW_IS_SET(cmd) && (iwr->u.data.length != 0)) { |
@@ -1259,7 +1253,7 @@ void wireless_send_event(struct net_device * dev, | |||
1259 | event->len = event_len; | 1253 | event->len = event_len; |
1260 | event->cmd = cmd; | 1254 | event->cmd = cmd; |
1261 | memcpy(&event->u, ((char *) wrqu) + wrqu_off, hdr_len - IW_EV_LCP_LEN); | 1255 | memcpy(&event->u, ((char *) wrqu) + wrqu_off, hdr_len - IW_EV_LCP_LEN); |
1262 | if (extra != NULL) | 1256 | if (extra) |
1263 | memcpy(((char *) event) + hdr_len, extra, extra_len); | 1257 | memcpy(((char *) event) + hdr_len, extra, extra_len); |
1264 | 1258 | ||
1265 | /* Send via the RtNetlink event channel */ | 1259 | /* Send via the RtNetlink event channel */ |
@@ -1290,11 +1284,11 @@ EXPORT_SYMBOL(wireless_send_event); | |||
1290 | * Because this is called on the Rx path via wireless_spy_update(), | 1284 | * Because this is called on the Rx path via wireless_spy_update(), |
1291 | * we want it to be efficient... | 1285 | * we want it to be efficient... |
1292 | */ | 1286 | */ |
1293 | static inline struct iw_spy_data * get_spydata(struct net_device *dev) | 1287 | static inline struct iw_spy_data *get_spydata(struct net_device *dev) |
1294 | { | 1288 | { |
1295 | /* This is the new way */ | 1289 | /* This is the new way */ |
1296 | if (dev->wireless_data) | 1290 | if (dev->wireless_data) |
1297 | return(dev->wireless_data->spy_data); | 1291 | return dev->wireless_data->spy_data; |
1298 | return NULL; | 1292 | return NULL; |
1299 | } | 1293 | } |
1300 | 1294 | ||