]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] ttpci: Replace memset with eth_zero_addr
authorVaishali Thakkar <vthakkar1994@gmail.com>
Fri, 26 Jun 2015 04:47:49 +0000 (01:47 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 11 Aug 2015 15:50:56 +0000 (12:50 -0300)
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>
drivers/media/pci/ttpci/budget-av.c
drivers/media/pci/ttpci/ttpci-eeprom.c

index 54c9910256f8cd4dc81ef339df56bcafe0df158e..3e469d4e0c8728a908d6d2756a7554b2c76e337e 100644 (file)
@@ -1508,7 +1508,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
        if (i2c_readregs(&budget_av->budget.i2c_adap, 0xa0, 0x30, mac, 6)) {
                pr_err("KNC1-%d: Could not read MAC from KNC1 card\n",
                       budget_av->budget.dvb_adapter.num);
-               memset(mac, 0, 6);
+               eth_zero_addr(mac);
        } else {
                pr_info("KNC1-%d: MAC addr = %pM\n",
                        budget_av->budget.dvb_adapter.num, mac);
index c6f31f2712bc6684e775a2626bf8ffa8f7ea8662..079ee098b7e37e4e9e2db442e83a5c0873fc6318 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/i2c.h>
+#include <linux/etherdevice.h>
 
 #include "ttpci-eeprom.h"
 
@@ -145,7 +146,7 @@ int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 *proposed_mac)
 
        if (ret != 0) {         /* Will only be -ENODEV */
                dprintk("Couldn't read from EEPROM: not there?\n");
-               memset(proposed_mac, 0, 6);
+               eth_zero_addr(proposed_mac);
                return ret;
        }
 
@@ -157,7 +158,7 @@ int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 *proposed_mac)
                        dprintk( "%.2x:", encodedMAC[i]);
                }
                dprintk("%.2x\n", encodedMAC[19]);
-               memset(proposed_mac, 0, 6);
+               eth_zero_addr(proposed_mac);
                return ret;
        }