linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 32/87] usb: pvrusb2: replace kmalloc and memset with kzalloc in pvrusb2-eeprom.c
@ 2019-06-27 17:38 Fuqian Huang
  2019-06-28  3:44 ` isely
  0 siblings, 1 reply; 2+ messages in thread
From: Fuqian Huang @ 2019-06-27 17:38 UTC (permalink / raw)
  Cc: Fuqian Huang, Mike Isely, Mauro Carvalho Chehab, linux-media,
	linux-kernel

kmalloc + memset(0) -> kzalloc

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
---
 drivers/media/usb/pvrusb2/pvrusb2-eeprom.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c b/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c
index 79f0e0c6df37..fac90af8b537 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c
@@ -39,7 +39,7 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw)
 	int ret;
 	int mode16 = 0;
 	unsigned pcnt,tcnt;
-	eeprom = kmalloc(EEPROM_SIZE,GFP_KERNEL);
+	eeprom = kzalloc(EEPROM_SIZE,GFP_KERNEL);
 	if (!eeprom) {
 		pvr2_trace(PVR2_TRACE_ERROR_LEGS,
 			   "Failed to allocate memory required to read eeprom");
@@ -74,7 +74,6 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw)
 	   (1) we're only fetching part of the eeprom, and (2) if we were
 	   getting the whole thing our I2C driver can't grab it in one
 	   pass - which is what tveeprom is otherwise going to attempt */
-	memset(eeprom,0,EEPROM_SIZE);
 	for (tcnt = 0; tcnt < EEPROM_SIZE; tcnt += pcnt) {
 		pcnt = 16;
 		if (pcnt + tcnt > EEPROM_SIZE) pcnt = EEPROM_SIZE-tcnt;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 32/87] usb: pvrusb2: replace kmalloc and memset with kzalloc in pvrusb2-eeprom.c
  2019-06-27 17:38 [PATCH 32/87] usb: pvrusb2: replace kmalloc and memset with kzalloc in pvrusb2-eeprom.c Fuqian Huang
@ 2019-06-28  3:44 ` isely
  0 siblings, 0 replies; 2+ messages in thread
From: isely @ 2019-06-28  3:44 UTC (permalink / raw)
  To: Fuqian Huang
  Cc: Mauro Carvalho Chehab, linux-media, Linux Kernel Mailing List,
	Mike Isely at pobox


Acked-by: Mike Isely <isely@pobox.com>

  -Mike

On Fri, 28 Jun 2019, Fuqian Huang wrote:

> kmalloc + memset(0) -> kzalloc
> 
> Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
> ---
>  drivers/media/usb/pvrusb2/pvrusb2-eeprom.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c b/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c
> index 79f0e0c6df37..fac90af8b537 100644
> --- a/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c
> +++ b/drivers/media/usb/pvrusb2/pvrusb2-eeprom.c
> @@ -39,7 +39,7 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw)
>  	int ret;
>  	int mode16 = 0;
>  	unsigned pcnt,tcnt;
> -	eeprom = kmalloc(EEPROM_SIZE,GFP_KERNEL);
> +	eeprom = kzalloc(EEPROM_SIZE,GFP_KERNEL);
>  	if (!eeprom) {
>  		pvr2_trace(PVR2_TRACE_ERROR_LEGS,
>  			   "Failed to allocate memory required to read eeprom");
> @@ -74,7 +74,6 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw)
>  	   (1) we're only fetching part of the eeprom, and (2) if we were
>  	   getting the whole thing our I2C driver can't grab it in one
>  	   pass - which is what tveeprom is otherwise going to attempt */
> -	memset(eeprom,0,EEPROM_SIZE);
>  	for (tcnt = 0; tcnt < EEPROM_SIZE; tcnt += pcnt) {
>  		pcnt = 16;
>  		if (pcnt + tcnt > EEPROM_SIZE) pcnt = EEPROM_SIZE-tcnt;
> 

-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-28  3:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 17:38 [PATCH 32/87] usb: pvrusb2: replace kmalloc and memset with kzalloc in pvrusb2-eeprom.c Fuqian Huang
2019-06-28  3:44 ` isely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).