Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1172590
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Vaishali Thakkar <vthakkar1994@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] [media] ttpci: Replace memset with eth_zero_addr |
| Date | Fri, 26 Jun 2015 06:50:01 +0200 |
| Message-ID | <pFtKp-5da-3@gated-at.bofh.it> (permalink) |
| X-Original-To | Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=Ut8G61o2ht+uGj/zVlTnDLvWCS5MTZD7yJEqXj0FsFc=; b=kJUtYNQeOgp8ijcDMUYHq2ybEGZyJMhdpRUXu9p7m06UrP0PA9vF6yxgaEL4LPMNVo Z2tQJooJRm+r2wg9EGR+udq092Whn7V5cAAN1ppEY7rX8OZV8UkCQDlr8L+0/4qWzbdg xY7A/a+h35ynBTE6P7SBq2PmdIqrvRO9xq4DWt3pTP53arZbDrgGJpXpH15kT/FNI2Z0 DrexyXawIdY4ebkILG+wx8PDpCSwSWKRsPUgjACl7brls5vtr9Td4EwbxS950KrMwxdd n2KkWgxG0WIq/+1hgGiAYo4JVMEZKhhgrJ7gPUTI0haym7BkfGlLEJW+qq6VUEJ8aSff JBNw== |
| X-Received | by 10.68.245.42 with SMTP id xl10mr6481747pbc.153.1435294078956; Thu, 25 Jun 2015 21:47:58 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| 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 | 73 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-media@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Fri, 26 Jun 2015 10:17:49 +0530 |
| X-Original-Message-ID | <20150626044749.GA18942@vaishali-Ideapad-Z570> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | aioe.org linux.kernel:1172590 |
Show key headers only | View raw
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>
---
drivers/media/pci/ttpci/budget-av.c | 2 +-
drivers/media/pci/ttpci/ttpci-eeprom.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/pci/ttpci/budget-av.c b/drivers/media/pci/ttpci/budget-av.c
index 54c9910..3e469d4 100644
--- a/drivers/media/pci/ttpci/budget-av.c
+++ b/drivers/media/pci/ttpci/budget-av.c
@@ -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);
diff --git a/drivers/media/pci/ttpci/ttpci-eeprom.c b/drivers/media/pci/ttpci/ttpci-eeprom.c
index 32d4315..01e13c4 100644
--- a/drivers/media/pci/ttpci/ttpci-eeprom.c
+++ b/drivers/media/pci/ttpci/ttpci-eeprom.c
@@ -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;
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] [media] ttpci: Replace memset with eth_zero_addr Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-06-26 06:50 +0200
csiph-web