Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1498348 > unrolled thread

[PATCH 0/5] Replace data type declarations with variables of same types in several source files.

Started bySergio Paracuellos <sergio.paracuellos@gmail.com>
First post2016-10-10 16:20 +0200
Last post2016-10-10 16:30 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5] Replace data type declarations with variables of  same types in several source files. Sergio Paracuellos <sergio.paracuellos@gmail.com> - 2016-10-10 16:20 +0200
    [PATCH 5/5] staging: wlan-ng: Replace data type declaration with variable of same type in prism2sta.c Sergio Paracuellos <sergio.paracuellos@gmail.com> - 2016-10-10 16:20 +0200
    [PATCH 4/5]  staging: wlan-ng: Replace data type declaration with variable of same type in p80211netdev.c Sergio Paracuellos <sergio.paracuellos@gmail.com> - 2016-10-10 16:30 +0200

#1498348 — [PATCH 0/5] Replace data type declarations with variables of same types in several source files.

FromSergio Paracuellos <sergio.paracuellos@gmail.com>
Date2016-10-10 16:20 +0200
Subject[PATCH 0/5] Replace data type declarations with variables of same types in several source files.
Message-ID<sqJAS-2hV-11@gated-at.bofh.it>
This patch series replaces several sizeof(struct XXX) stuff in favour 
of sizeof(var) which is the preferred one.

Sergio Paracuellos (5):
  staging: wlan-ng: Replace data type declaration with variable of same
    type in cfg80211.c
  staging: wlan-ng: Replace data type declaration with variable of same
    type in hfa384x_usb.c
  staging: wlan-ng: Replace data type declaration with variable of same
    type in p80211conv.c
  staging: wlan-ng: Replace data type declaration with variable of same
    type in p80211netdev.c
  staging: wlan-ng: Replace data type declaration with variable of same
    type in prism2sta.c

 drivers/staging/wlan-ng/cfg80211.c     |  2 +-
 drivers/staging/wlan-ng/hfa384x_usb.c  |  2 +-
 drivers/staging/wlan-ng/p80211conv.c   |  2 +-
 drivers/staging/wlan-ng/p80211netdev.c | 12 ++++++------
 drivers/staging/wlan-ng/prism2sta.c    |  6 +++---
 5 files changed, 12 insertions(+), 12 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1498349 — [PATCH 5/5] staging: wlan-ng: Replace data type declaration with variable of same type in prism2sta.c

FromSergio Paracuellos <sergio.paracuellos@gmail.com>
Date2016-10-10 16:20 +0200
Subject[PATCH 5/5] staging: wlan-ng: Replace data type declaration with variable of same type in prism2sta.c
Message-ID<sqJAS-2hV-21@gated-at.bofh.it>
In reply to#1498348
sizeof(*var) instead of sizeof(struct XXX) is preferred.
Fix them in prism2sta.c file.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/wlan-ng/prism2sta.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index b3ae2bb..351f08d 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -1102,8 +1102,7 @@ static void prism2sta_inf_hostscanresults(struct wlandevice *wlandev,
 
 	kfree(hw->scanresults);
 
-	hw->scanresults = kmemdup(inf, sizeof(struct hfa384x_inf_frame),
-				  GFP_ATOMIC);
+	hw->scanresults = kmemdup(inf, sizeof(*inf), GFP_ATOMIC);
 
 	if (nbss == 0)
 		nbss = -1;
@@ -1888,8 +1887,8 @@ static struct wlandevice *create_wlan(void)
 	struct hfa384x *hw = NULL;
 
 	/* Alloc our structures */
-	wlandev = kzalloc(sizeof(struct wlandevice), GFP_KERNEL);
-	hw = kzalloc(sizeof(struct hfa384x), GFP_KERNEL);
+	wlandev = kzalloc(sizeof(*wlandev), GFP_KERNEL);
+	hw = kzalloc(sizeof(*hw), GFP_KERNEL);
 
 	if (!wlandev || !hw) {
 		kfree(wlandev);
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1498360 — [PATCH 4/5] staging: wlan-ng: Replace data type declaration with variable of same type in p80211netdev.c

FromSergio Paracuellos <sergio.paracuellos@gmail.com>
Date2016-10-10 16:30 +0200
Subject[PATCH 4/5] staging: wlan-ng: Replace data type declaration with variable of same type in p80211netdev.c
Message-ID<sqJKy-2la-21@gated-at.bofh.it>
In reply to#1498348
sizeof(var) instead of sizeof(struct XXX) is preferred. 
Fix them in p80211netdev.c

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/wlan-ng/p80211netdev.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 825a63a..3a95b36 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -336,8 +336,8 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
 		goto failed;
 	}
 
-	memset(&p80211_hdr, 0, sizeof(union p80211_hdr));
-	memset(&p80211_wep, 0, sizeof(struct p80211_metawep));
+	memset(&p80211_hdr, 0, sizeof(p80211_hdr));
+	memset(&p80211_wep, 0, sizeof(p80211_wep));
 
 	if (netif_queue_stopped(netdev)) {
 		netdev_dbg(netdev, "called when queue stopped.\n");
@@ -375,8 +375,8 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
 			goto failed;
 		}
 		/* move the header over */
-		memcpy(&p80211_hdr, skb->data, sizeof(union p80211_hdr));
-		skb_pull(skb, sizeof(union p80211_hdr));
+		memcpy(&p80211_hdr, skb->data, sizeof(p80211_hdr));
+		skb_pull(skb, sizeof(p80211_hdr));
 	} else {
 		if (skb_ether_to_p80211
 		    (wlandev, wlandev->ethconv, skb, &p80211_hdr,
@@ -629,9 +629,9 @@ static int p80211knetdev_set_mac_address(struct net_device *dev, void *addr)
 	resultcode = &dot11req.resultcode;
 
 	/* Set up a dot11req_mibset */
-	memset(&dot11req, 0, sizeof(struct p80211msg_dot11req_mibset));
+	memset(&dot11req, 0, sizeof(dot11req));
 	dot11req.msgcode = DIDmsg_dot11req_mibset;
-	dot11req.msglen = sizeof(struct p80211msg_dot11req_mibset);
+	dot11req.msglen = sizeof(dot11req);
 	memcpy(dot11req.devname,
 	       ((struct wlandevice *)dev->ml_priv)->name, WLAN_DEVNAMELEN_MAX - 1);
 
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web