2016-10-10 14:12:06

by Sergio Paracuellos

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

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


2016-10-10 14:15:21

by Sergio Paracuellos

[permalink] [raw]
Subject: [PATCH 2/5] staging: wlan-ng: Replace data type declaration with variable of same type in hfa384x_usb.c

sizeof(var) instead of sizeof(struct XXX) is preferred.
Fix it in hfa384x_usb.c file.

Signed-off-by: Sergio Paracuellos <[email protected]>
---
drivers/staging/wlan-ng/hfa384x_usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index fbd9dc6..a83026e 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -531,7 +531,7 @@ static void hfa384x_usb_defer(struct work_struct *data)
*/
void hfa384x_create(struct hfa384x *hw, struct usb_device *usb)
{
- memset(hw, 0, sizeof(struct hfa384x));
+ memset(hw, 0, sizeof(*hw));
hw->usb = usb;

/* set up the endpoints */
--
1.9.1

2016-10-10 14:17:48

by Sergio Paracuellos

[permalink] [raw]
Subject: [PATCH 5/5] staging: wlan-ng: Replace data type declaration with variable of same type in prism2sta.c

sizeof(*var) instead of sizeof(struct XXX) is preferred.
Fix them in prism2sta.c file.

Signed-off-by: Sergio Paracuellos <[email protected]>
---
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

2016-10-10 14:17:56

by Sergio Paracuellos

[permalink] [raw]
Subject: [PATCH 3/5] staging: wlan-ng: Replace data type declaration with variable of same type in p80211conv.c

sizeof(*var) instead of sizeof(struct XXX) is preferred.
Fix it in p80211conv.c file.

Signed-off-by: Sergio Paracuellos <[email protected]>
---
drivers/staging/wlan-ng/p80211conv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c
index 0247cbc..bbed7ff 100644
--- a/drivers/staging/wlan-ng/p80211conv.c
+++ b/drivers/staging/wlan-ng/p80211conv.c
@@ -615,7 +615,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb)
}

/* Allocate the rxmeta */
- rxmeta = kzalloc(sizeof(struct p80211_rxmeta), GFP_ATOMIC);
+ rxmeta = kzalloc(sizeof(*rxmeta), GFP_ATOMIC);

if (!rxmeta) {
netdev_err(wlandev->netdev,
--
1.9.1

2016-10-10 14:19:47

by Sergio Paracuellos

[permalink] [raw]
Subject: [PATCH 1/5] staging: wlan-ng: Replace data type declaration with variable of same type in cfg80211.c

sizeof(var) instead of sizeof(struct XXX) is preferred.
Fix it in cfg80211.c file.

Signed-off-by: Sergio Paracuellos <[email protected]>
---
drivers/staging/wlan-ng/cfg80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 182b2d5..67c48a8 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -323,7 +323,7 @@ static int prism2_scan(struct wiphy *wiphy,

priv->scan_request = request;

- memset(&msg1, 0x00, sizeof(struct p80211msg_dot11req_scan));
+ memset(&msg1, 0x00, sizeof(msg1));
msg1.msgcode = DIDmsg_dot11req_scan;
msg1.bsstype.data = P80211ENUM_bsstype_any;

--
1.9.1

2016-10-10 14:20:32

by Sergio Paracuellos

[permalink] [raw]
Subject: [PATCH 4/5] staging: wlan-ng: Replace data type declaration with variable of same type in p80211netdev.c

sizeof(var) instead of sizeof(struct XXX) is preferred.
Fix them in p80211netdev.c

Signed-off-by: Sergio Paracuellos <[email protected]>
---
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

2016-10-16 08:24:27

by Alexander Alemayhu

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

On Mon, Oct 10, 2016 at 04:02:17PM +0200, Sergio Paracuellos wrote:
> This patch series replaces several sizeof(struct XXX) stuff in favour
> of sizeof(var) which is the preferred one.
>

Why not squash this series into one patch? The commit messages are fairly
similar and the changes are focused into one area. Would be better with one
commit, IMO.

--
Mit freundlichen Gr??en

Alexander Alemayhu

2016-10-16 18:55:03

by Sergio Paracuellos

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



El 2016年10月16日 a las 10:24, Alexander Alemayhu escribió:
> On Mon, Oct 10, 2016 at 04:02:17PM +0200, Sergio Paracuellos wrote:
>> This patch series replaces several sizeof(struct XXX) stuff in favour
>> of sizeof(var) which is the preferred one.
>>
>
> Why not squash this series into one patch? The commit messages are fairly
> similar and the changes are focused into one area. Would be better with one
> commit, IMO.
>

Commit messages are similar but applies to different files. That was the
reason of sending the patchset and not only one patch. If it had been
better to send only one patch please, let me know to be correct next
time. The patchset seems that has been already added to the staging branch.

Thanks in advance.

Cheers,
Sergio Paracuellos