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


Groups > linux.kernel > #1305507

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

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] [media] netup_unidvb: Remove a useless memset
Date Sun, 10 Jan 2016 08:30:02 +0100
Message-ID <qPiBQ-14T-9@gated-at.bofh.it> (permalink)
References <qPiBP-14T-3@gated-at.bofh.it>
X-Original-To Christophe JAILLET <christophe.jaillet@wanadoo.fr>, serjk@netup.ru, mchehab@osg.samsung.com
X-Session-Marker 6A6F6540706572636865732E636F6D
X-Spam-Summary 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2919:3138:3139:3140:3141:3142:3352:3622:3865:3867:3871:3872:4250:4321:5007:6261:8660:9592:10004:10400:10848:11026:11232:11473:11657:11658:11783:11914:12043:12296:12438:12517:12519:12555:12740:13069:13148:13230:13311:13357:13894:14659:21080:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none
X-He-Tag ball53_8f36b775be646
X-Filterd-Recvd-Size 2217
Content-Type text/plain; charset="ISO-8859-1"
X-Mailer Evolution 3.18.3-1ubuntu1
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 35
Organization linux.* mail to news gateway
X-Original-Cc linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
X-Original-Date Sat, 09 Jan 2016 23:29:41 -0800
X-Original-Message-ID <1452410981.7773.10.camel@perches.com>
X-Original-References <1452410416-6362-1-git-send-email-christophe.jaillet@wanadoo.fr>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1305507

Show key headers only | View raw


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) {

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[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

csiph-web