Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] ttpci: Replace memset with eth_zero_addr

Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.
Note that the 6 in the third argument of memset appears to represent
an ethernet address size (ETH_ALEN).

The Coccinelle semantic patch that makes this change is as follows:

// <smpl>
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,6);
+eth_zero_addr(e);
// </smpl>

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Vaishali Thakkar and committed by
Mauro Carvalho Chehab
fa9163b5 a73df858

+4 -3
+1 -1
drivers/media/pci/ttpci/budget-av.c
··· 1508 1508 if (i2c_readregs(&budget_av->budget.i2c_adap, 0xa0, 0x30, mac, 6)) { 1509 1509 pr_err("KNC1-%d: Could not read MAC from KNC1 card\n", 1510 1510 budget_av->budget.dvb_adapter.num); 1511 - memset(mac, 0, 6); 1511 + eth_zero_addr(mac); 1512 1512 } else { 1513 1513 pr_info("KNC1-%d: MAC addr = %pM\n", 1514 1514 budget_av->budget.dvb_adapter.num, mac);
+3 -2
drivers/media/pci/ttpci/ttpci-eeprom.c
··· 36 36 #include <linux/module.h> 37 37 #include <linux/string.h> 38 38 #include <linux/i2c.h> 39 + #include <linux/etherdevice.h> 39 40 40 41 #include "ttpci-eeprom.h" 41 42 ··· 146 145 147 146 if (ret != 0) { /* Will only be -ENODEV */ 148 147 dprintk("Couldn't read from EEPROM: not there?\n"); 149 - memset(proposed_mac, 0, 6); 148 + eth_zero_addr(proposed_mac); 150 149 return ret; 151 150 } 152 151 ··· 158 157 dprintk( "%.2x:", encodedMAC[i]); 159 158 } 160 159 dprintk("%.2x\n", encodedMAC[19]); 161 - memset(proposed_mac, 0, 6); 160 + eth_zero_addr(proposed_mac); 162 161 return ret; 163 162 } 164 163