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


Groups > linux.kernel > #1305505 > unrolled thread

[PATCH] [media] netup_unidvb: Remove a useless memset

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2016-01-10 08:30 +0100
Last post2016-01-10 08:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] [media] netup_unidvb: Remove a useless memset Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-01-10 08:30 +0100
    Re: [PATCH] [media] netup_unidvb: Remove a useless memset Joe Perches <joe@perches.com> - 2016-01-10 08:30 +0100

#1305505 — [PATCH] [media] netup_unidvb: Remove a useless memset

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2016-01-10 08:30 +0100
Subject[PATCH] [media] netup_unidvb: Remove a useless memset
Message-ID<qPiBP-14T-3@gated-at.bofh.it>
This memory is allocated using kzalloc so there is no need to call
memset(..., 0, ...)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/media/pci/netup_unidvb/netup_unidvb_core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
index 525ebfe..d919080 100644
--- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
+++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
@@ -774,7 +774,6 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
 
 	if (!ndev)
 		goto dev_alloc_err;
-	memset(ndev, 0, sizeof(*ndev));
 	ndev->old_fw = old_firmware;
 	ndev->wq = create_singlethread_workqueue(NETUP_UNIDVB_NAME);
 	if (!ndev->wq) {
-- 
2.5.0

[toc] | [next] | [standalone]


#1305507

FromJoe Perches <joe@perches.com>
Date2016-01-10 08:30 +0100
Message-ID<qPiBQ-14T-9@gated-at.bofh.it>
In reply to#1305505
On Sun, 2016-01-10 at 08:20 +0100, Christophe JAILLET wrote:
> This memory is allocated using kzalloc so there is no need to call
> memset(..., 0, ...)
[]
> diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
[]
> @@ -774,7 +774,6 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
>  
>  	if (!ndev)
>  		goto dev_alloc_err;
> -	memset(ndev, 0, sizeof(*ndev));
>  	ndev->old_fw = old_firmware;
>  	ndev->wq = create_singlethread_workqueue(NETUP_UNIDVB_NAME);
>  	if (!ndev->wq) {

It's unusual to not see the alloc above the if

Perhaps it'd be more standard to do something like:
---
diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
index 525ebfe..c94cecd 100644
--- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
+++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c
@@ -771,10 +771,9 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev,
 
 	/* allocate device context */
 	ndev = kzalloc(sizeof(*ndev), GFP_KERNEL);
-
 	if (!ndev)
 		goto dev_alloc_err;
-	memset(ndev, 0, sizeof(*ndev));
+
 	ndev->old_fw = old_firmware;
 	ndev->wq = create_singlethread_workqueue(NETUP_UNIDVB_NAME);
 	if (!ndev->wq) {

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web