staging: wilc1000: linux_mon: use __packed instead of __attribute__((packed))
PATCH 1/11 staging: wilc1000: linux_mon: use __packed instead of __attribute__((packed))
This patch fixes the following checkpatch warning:
WARNING: __packed is preferred over __attribute__((packed))
--- drivers/staging/wilc1000/linux_mon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/linux_mon.c +2 -2
@@ -15,14 +15,14 @@struct wilc_wfi_radiotap_hdr {struct ieee80211_radiotap_header hdr;u8 rate; -} __attribute__((packed)); +} __packed;struct wilc_wfi_radiotap_cb_hdr {struct ieee80211_radiotap_header hdr;u8 rate;u8 dump;u16 tx_flags; -} __attribute__((packed)); +} __packed;static struct net_device *wilc_wfi_mon;/* global monitor netdev */
Signature · 1 line
2.7.0
PATCH 2/11 staging: wilc1000: linux_mon: remove blank lines after open brace '{'
This patch remove blank lines after open brace found by checkpatch.pl
CHECK: Blank lines aren't necessary after an open brace '{'
--- drivers/staging/wilc1000/linux_mon.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/wilc1000/linux_mon.c +0 -5
@@ -71,7 +71,6 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) pkt_offset =GET_PKT_OFFSET (header);if (pkt_offset &IS_MANAGMEMENT_CALLBACK ) { -/* hostapd callback mgmt frame */ skb =dev_alloc_skb (size +sizeof (struct wilc_wfi_radiotap_cb_hdr ));
@@ -103,7 +102,6 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) } }else { - skb =dev_alloc_skb (size +sizeof (struct wilc_wfi_radiotap_hdr ));if (skb ==NULL ) {
@@ -145,7 +143,6 @@ struct tx_complete_mon_data {static void mgmt_tx_complete (void *priv,int status) { -struct tx_complete_mon_data *pv_data = (struct tx_complete_mon_data *)priv;u8 *buf = pv_data->buff;
@@ -316,8 +313,6 @@ static const struct net_device_ops wilc_wfi_netdev_ops = {*/ struct net_device *WILC_WFI_init_mon_interface (const char *name,struct net_device *real_dev) { - -u32 ret =0 ;struct WILC_WFI_mon_priv *priv;
Signature · 1 line
2.7.0
PATCH 3/11 staging: wilc1000: linux_mon: remove blank line before a close brace '}'
In reply to Chaehyun LimThis patch removes blank lines before a close brace found by checkpatch.pl
CHECK: Blank lines aren't necessary before a close brace '}'
--- drivers/staging/wilc1000/linux_mon.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/staging/wilc1000/linux_mon.c +0 -6
@@ -119,7 +119,6 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) (1 <<IEEE80211_RADIOTAP_RATE );/* | */ PRINT_INFO (HOSTAPD_DBG ,"Presentflags %d\n" , hdr->hdr.it_present); hdr->rate =5 ;/* txrate->bitrate / 5; */ - }
@@ -132,8 +131,6 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)memset (skb->cb,0 ,sizeof (skb->cb));netif_rx (skb); - - }struct tx_complete_mon_data {
@@ -183,7 +180,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)PRINT_ER ("Failed to allocate memory for mgmt_tx buff\n" );kfree (mgmt_tx);return -EFAULT ; - } mgmt_tx->size = len;
@@ -325,7 +321,6 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_deviif (!wilc_wfi_mon) {PRINT_ER ("failed to allocate memory\n" );return NULL ; - } wilc_wfi_mon->type =ARPHRD_IEEE80211_RADIOTAP ;
@@ -379,5 +374,4 @@ int WILC_WFI_deinit_mon_interface(void) wilc_wfi_mon =NULL ; }return 0 ; - }
Signature · 1 line
2.7.0
PATCH 4/11 staging: wilc1000: linux_mon: remove multiple blank lines
In reply to Chaehyun LimThis patch removes multiple blank lines found by checkpatch.pl
CHECK: Please don't use multiple blank lines
--- drivers/staging/wilc1000/linux_mon.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/staging/wilc1000/linux_mon.c +0 -10
@@ -11,7 +11,6 @@#include "wilc_wlan_if.h" #include "wilc_wlan.h" -struct wilc_wfi_radiotap_hdr {struct ieee80211_radiotap_header hdr;u8 rate;
@@ -121,8 +120,6 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) hdr->rate =5 ;/* txrate->bitrate / 5; */ } - - skb->dev = wilc_wfi_mon;skb_set_mac_header (skb,0 ); skb->ip_summed =CHECKSUM_UNNECESSARY ;
@@ -143,8 +140,6 @@ static void mgmt_tx_complete(void *priv, int status)struct tx_complete_mon_data *pv_data = (struct tx_complete_mon_data *)priv;u8 *buf = pv_data->buff; - -if (status ==1 ) {if (INFO || buf[0 ] ==0x10 || buf[0 ] ==0xb0 )PRINT_INFO (HOSTAPD_DBG ,"Packet sent successfully - Size = %d - Address = %p.\n" , pv_data->size, pv_data->buff);
@@ -152,8 +147,6 @@ static void mgmt_tx_complete(void *priv, int status)PRINT_INFO (HOSTAPD_DBG ,"Couldn't send packet - Size = %d - Address = %p.\n" , pv_data->size, pv_data->buff); } - -/* incase of fully hosting mode, the freeing will be done in response to the cfg packet */ kfree (pv_data->buff);
@@ -220,7 +213,6 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,return -EFAULT ; } - rtap_len =ieee80211_get_radiotap_len (skb->data);if (skb->len < rtap_len) {PRINT_ER ("Error in radiotap header\n" );
@@ -273,8 +265,6 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,PRINT_INFO (HOSTAPD_DBG ,"Skipping the radiotap header\n" ); - -/* actual deliver of data is device-specific, and not shown here */ PRINT_INFO (HOSTAPD_DBG ,"SKB netdevice name = %s\n" , skb->dev->name);PRINT_INFO (HOSTAPD_DBG ,"MONITOR real dev name = %s\n" , mon_priv->real_ndev->name);
Signature · 1 line
2.7.0
PATCH 5/11 staging: wilc1000: linux_mon: fix NULL comparison style
In reply to Chaehyun LimThis patch fixes NULL comparsion style found by checkpatch.pl
CHECK: Comparison to NULL could be written "!wilc_wfi_mon"
CHECK: Comparison to NULL could be written "!skb"
CHECK: Comparison to NULL could be written "!skb"
CHECK: Comparison to NULL could be written "!dev"
CHECK: Comparison to NULL could be written "!mgmt_tx"
CHECK: Comparison to NULL could be written "!mgmt_tx->buff"
CHECK: Comparison to NULL could be written "!wilc_wfi_mon"
CHECK: Comparison to NULL could be written "!mon_priv"
CHECK: Comparison to NULL could be written "!priv"
CHECK: Comparison to NULL could be written "wilc_wfi_mon"
--- drivers/staging/wilc1000/linux_mon.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/staging/wilc1000/linux_mon.c +10 -10
@@ -54,7 +54,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)PRINT_INFO (HOSTAPD_DBG ,"In monitor interface receive function\n" ); -if (wilc_wfi_mon ==NULL ) +if (!wilc_wfi_mon)return ;if (!netif_running (wilc_wfi_mon)) {
@@ -73,7 +73,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)/* hostapd callback mgmt frame */ skb =dev_alloc_skb (size +sizeof (struct wilc_wfi_radiotap_cb_hdr )); -if (skb ==NULL ) { +if (!skb) {PRINT_INFO (HOSTAPD_DBG ,"Monitor if : No memory to allocate skb" );return ; }
@@ -103,7 +103,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) }else { skb =dev_alloc_skb (size +sizeof (struct wilc_wfi_radiotap_hdr )); -if (skb ==NULL ) { +if (!skb) {PRINT_INFO (HOSTAPD_DBG ,"Monitor if : No memory to allocate skb" );return ; }
@@ -156,20 +156,20 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) {struct tx_complete_mon_data *mgmt_tx =NULL ; -if (dev ==NULL ) { +if (!dev) {PRINT_D (HOSTAPD_DBG ,"ERROR: dev == NULL\n" );return -EFAULT ; }netif_stop_queue (dev); mgmt_tx =kmalloc (sizeof (struct tx_complete_mon_data ),GFP_ATOMIC ); -if (mgmt_tx ==NULL ) { +if (!mgmt_tx) {PRINT_ER ("Failed to allocate memory for mgmt_tx structure\n" );return -EFAULT ; } mgmt_tx->buff =kmalloc (len,GFP_ATOMIC ); -if (mgmt_tx->buff ==NULL ) { +if (!mgmt_tx->buff) {PRINT_ER ("Failed to allocate memory for mgmt_tx buff\n" );kfree (mgmt_tx);return -EFAULT ;
@@ -203,12 +203,12 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,struct sk_buff *skb2;struct wilc_wfi_radiotap_cb_hdr *cb_hdr; -if (wilc_wfi_mon ==NULL ) +if (!wilc_wfi_mon)return -EFAULT ; mon_priv =netdev_priv (wilc_wfi_mon); -if (mon_priv ==NULL ) { +if (!mon_priv) {PRINT_ER ("Monitor interface private structure is NULL\n" );return -EFAULT ; }
@@ -324,7 +324,7 @@ struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_devireturn NULL ; } priv =netdev_priv (wilc_wfi_mon); -if (priv ==NULL ) { +if (!priv) {PRINT_ER ("private structure is NULL\n" );return NULL ; }
@@ -347,7 +347,7 @@ int WILC_WFI_deinit_mon_interface(void) {bool rollback_lock = false; -if (wilc_wfi_mon !=NULL ) { +if (wilc_wfi_mon) {PRINT_D (HOSTAPD_DBG ,"In Deinit monitor interface\n" );PRINT_D (HOSTAPD_DBG ,"RTNL is being locked\n" );if (rtnl_is_locked ()) {
Signature · 1 line
2.7.0
PATCH 6/11 staging: wilc1000: linux_mon: remove space after a cast
In reply to Chaehyun LimThis patch removes space after a type cast found by checkpatch.pl
CHECK: No space is necessary after a cast
--- drivers/staging/wilc1000/linux_mon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/linux_mon.c +3 -3
@@ -80,7 +80,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)memcpy (skb_put (skb, size), buff, size); - cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push (skb,sizeof (*cb_hdr)); + cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push (skb,sizeof (*cb_hdr));memset (cb_hdr,0 ,sizeof (struct wilc_wfi_radiotap_cb_hdr )); cb_hdr->hdr.it_version =0 ;/* PKTHDR_RADIOTAP_VERSION; */
@@ -109,7 +109,7 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size) }memcpy (skb_put (skb, size), buff, size); - hdr = (struct wilc_wfi_radiotap_hdr *)skb_push (skb,sizeof (*hdr)); + hdr = (struct wilc_wfi_radiotap_hdr *)skb_push (skb,sizeof (*hdr));memset (hdr,0 ,sizeof (struct wilc_wfi_radiotap_hdr )); hdr->hdr.it_version =0 ;/* PKTHDR_RADIOTAP_VERSION; */ hdr->hdr.it_len =cpu_to_le16 (sizeof (struct wilc_wfi_radiotap_hdr ));
@@ -236,7 +236,7 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,memcpy (skb_put (skb2, skb->len), skb->data, skb->len); - cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push (skb2,sizeof (*cb_hdr)); + cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push (skb2,sizeof (*cb_hdr));memset (cb_hdr,0 ,sizeof (struct wilc_wfi_radiotap_cb_hdr )); cb_hdr->hdr.it_version =0 ;/* PKTHDR_RADIOTAP_VERSION; */
Signature · 1 line
2.7.0
PATCH 7/11 staging: wilc1000: linux_mon: insert blank line after a function
In reply to Chaehyun LimThis patch inserts a blank line afer function found by checkpatch.pl
CHECK: Please use a blank line after function/struct/union/enum declarations
--- drivers/staging/wilc1000/linux_mon.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/wilc1000/linux_mon.c +1 -0
@@ -152,6 +152,7 @@ static void mgmt_tx_complete(void *priv, int status)kfree (pv_data); } +static int mon_mgmt_tx (struct net_device *dev,const u8 *buf,size_t len) {struct tx_complete_mon_data *mgmt_tx =NULL ;
Signature · 1 line
2.7.0
PATCH 8/11 staging: wilc1000: linux_mon: add braces on all arms of if statement
In reply to Chaehyun LimThis patch adds braces on all arms of if statement found by checkpatch.pl
CHECK: braces {} should be used on all arms of this statement
--- drivers/staging/wilc1000/linux_mon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/wilc1000/linux_mon.c +2 -1
@@ -278,8 +278,9 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,if (!(memcmp (srcAdd, bssid,6 ))) {mon_mgmt_tx (mon_priv->real_ndev, skb->data, skb->len);dev_kfree_skb (skb); - }else + }else { ret =wilc_mac_xmit (skb, mon_priv->real_ndev); + }return ret; }
Signature · 1 line
2.7.0
PATCH 9/11 staging: wilc1000: linux_mon: fix coding style of kmalloc usage
In reply to Chaehyun LimThis patch fixes coding style of kmalloc usage found by checkpatch.pl
CHECK: Prefer kmalloc(sizeof(*mgmt_tx)...) over kmalloc(sizeof(struct tx_complete_mon_data)...)
--- drivers/staging/wilc1000/linux_mon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/linux_mon.c +1 -1
@@ -163,7 +163,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) }netif_stop_queue (dev); - mgmt_tx =kmalloc (sizeof (struct tx_complete_mon_data ),GFP_ATOMIC ); + mgmt_tx =kmalloc (sizeof (*mgmt_tx),GFP_ATOMIC );if (!mgmt_tx) {PRINT_ER ("Failed to allocate memory for mgmt_tx structure\n" );return -EFAULT ;
Signature · 1 line
2.7.0
PATCH 10/11 staging: wilc1000: linux_mon: fix error code of kmalloc
In reply to Chaehyun LimThis patch fixes error codes as -ENOMEM instead of using -EFAULT if kmalloc is failed.
--- drivers/staging/wilc1000/linux_mon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/linux_mon.c +2 -2
@@ -166,14 +166,14 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) mgmt_tx =kmalloc (sizeof (*mgmt_tx),GFP_ATOMIC );if (!mgmt_tx) {PRINT_ER ("Failed to allocate memory for mgmt_tx structure\n" ); -return -EFAULT ; +return -ENOMEM ; } mgmt_tx->buff =kmalloc (len,GFP_ATOMIC );if (!mgmt_tx->buff) {PRINT_ER ("Failed to allocate memory for mgmt_tx buff\n" );kfree (mgmt_tx); -return -EFAULT ; +return -ENOMEM ; } mgmt_tx->size = len;
Signature · 1 line
2.7.0
PATCH 11/11 staging: wilc1000: linux_mon: remove debug message of kmalloc failure
In reply to Chaehyun LimThere is no need to print debug message when kmalloc is failed. This message is redundant. The code already show us that kmalloc is failed. The braces of first if statement is remove as well because if statement has a single statement.
--- drivers/staging/wilc1000/linux_mon.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/wilc1000/linux_mon.c +1 -4
@@ -164,14 +164,11 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)netif_stop_queue (dev); mgmt_tx =kmalloc (sizeof (*mgmt_tx),GFP_ATOMIC ); -if (!mgmt_tx) { -PRINT_ER ("Failed to allocate memory for mgmt_tx structure\n" ); +if (!mgmt_tx)return -ENOMEM ; - } mgmt_tx->buff =kmalloc (len,GFP_ATOMIC );if (!mgmt_tx->buff) { -PRINT_ER ("Failed to allocate memory for mgmt_tx buff\n" );kfree (mgmt_tx);return -ENOMEM ; }
Signature · 1 line
2.7.0