diff mbox

[v2] brcmsmac: Use kstrdup to simplify code

Message ID 1436386966-16148-1-git-send-email-christophe.jaillet@wanadoo.fr (mailing list archive)
State Accepted
Delegated to: Kalle Valo
Headers show

Commit Message

Christophe JAILLET July 8, 2015, 8:22 p.m. UTC
Replace a kmalloc+strcpy by an equivalent kstrdup in order to improve
readability.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: fix the subject

 drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Arend van Spriel July 9, 2015, 6:36 p.m. UTC | #1
On 07/08/2015 10:22 PM, Christophe JAILLET wrote:
> Replace a kmalloc+strcpy by an equivalent kstrdup in order to improve
> readability.

Not sure if readability is really the issue here. At most it is a small 
reduction of driver code by using kstrdup(). Anyway, the patch looks fine so

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: fix the subject
>
>   drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
> index 4813506..8a6c077 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
> @@ -1476,9 +1476,7 @@ struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
>   	wl->timers = t;
>
>   #ifdef DEBUG
> -	t->name = kmalloc(strlen(name) + 1, GFP_ATOMIC);
> -	if (t->name)
> -		strcpy(t->name, name);
> +	t->name = kstrdup(name, GFP_ATOMIC);
>   #endif
>
>   	return t;
>

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo July 21, 2015, 2:59 p.m. UTC | #2
> Replace a kmalloc+strcpy by an equivalent kstrdup in order to improve
> readability.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Acked-by: Arend van Spriel <arend@broadcom.com>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 4813506..8a6c077 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -1476,9 +1476,7 @@  struct brcms_timer *brcms_init_timer(struct brcms_info *wl,
 	wl->timers = t;
 
 #ifdef DEBUG
-	t->name = kmalloc(strlen(name) + 1, GFP_ATOMIC);
-	if (t->name)
-		strcpy(t->name, name);
+	t->name = kstrdup(name, GFP_ATOMIC);
 #endif
 
 	return t;