]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: pvrusb2: use kzalloc instead of kmalloc and memset
authorFuqian Huang <huangfq.daxian@gmail.com>
Fri, 28 Jun 2019 02:47:56 +0000 (23:47 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 13 Aug 2019 14:48:57 +0000 (11:48 -0300)
Replace kmalloc followed by a memset with kzalloc.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: add pvrusb2: prefix in Subject]
[hverkuil-cisco@xs4all.nl: fix checkpatch whitespace warnings]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/pvrusb2/pvrusb2-eeprom.c
drivers/media/usb/pvrusb2/pvrusb2-hdw.c

index 79f0e0c6df37b2411386aa7dacbd74875b2e2703..8e81af53790174e2b9f683884d6f85b96a4bb4a7 100644 (file)
@@ -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;
index 6fe8b9af858ac633dad6fecf3cb2046821cdefbf..e5afbcacdb37af9141c271ba86b5e59011ec5741 100644 (file)
@@ -3329,7 +3329,7 @@ static u8 *pvr2_full_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");
@@ -3364,7 +3364,6 @@ static u8 *pvr2_full_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;