diff mbox

sfc: Replace memset with eth_zero_addr

Message ID 1484538981-24591-1-git-send-email-mayhs11saini@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Shyam Saini Jan. 16, 2017, 3:56 a.m. UTC
Use eth_zero_addr to assign zero address to the given address array
instead of memset when the second argument in memset is address
of zero which makes the code clearer and also add header
file linux/etherdevice.h

Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
 drivers/net/ethernet/sfc/ef10_sriov.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Edward Cree Jan. 16, 2017, 9:35 a.m. UTC | #1
On 16/01/17 03:56, Shyam Saini wrote:
> Use eth_zero_addr to assign zero address to the given address array
> instead of memset when the second argument in memset is address
> of zero which makes the code clearer and also add header
> file linux/etherdevice.h
>
> Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
> ---
Acked-by: Edward Cree <ecree@solarflare.com>
>  drivers/net/ethernet/sfc/ef10_sriov.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
> index a949b9d..228806c 100644
> --- a/drivers/net/ethernet/sfc/ef10_sriov.c
> +++ b/drivers/net/ethernet/sfc/ef10_sriov.c
> @@ -6,6 +6,7 @@
>   * under the terms of the GNU General Public License version 2 as published
>   * by the Free Software Foundation, incorporated herein by reference.
>   */
> +#include <linux/etherdevice.h>
>  #include <linux/pci.h>
>  #include <linux/module.h>
>  #include "net_driver.h"
> @@ -554,7 +555,7 @@ int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac)
>  	return 0;
>  
>  fail:
> -	memset(vf->mac, 0, ETH_ALEN);
> +	eth_zero_addr(vf->mac);
>  	return rc;
>  }
>
David Miller Jan. 16, 2017, 4:47 p.m. UTC | #2
From: Edward Cree <ecree@solarflare.com>
Date: Mon, 16 Jan 2017 09:35:38 +0000

> On 16/01/17 03:56, Shyam Saini wrote:
>> Use eth_zero_addr to assign zero address to the given address array
>> instead of memset when the second argument in memset is address
>> of zero which makes the code clearer and also add header
>> file linux/etherdevice.h
>>
>> Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
>> ---
> Acked-by: Edward Cree <ecree@solarflare.com>

Applied to net-next.
diff mbox

Patch

diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
index a949b9d..228806c 100644
--- a/drivers/net/ethernet/sfc/ef10_sriov.c
+++ b/drivers/net/ethernet/sfc/ef10_sriov.c
@@ -6,6 +6,7 @@ 
  * under the terms of the GNU General Public License version 2 as published
  * by the Free Software Foundation, incorporated herein by reference.
  */
+#include <linux/etherdevice.h>
 #include <linux/pci.h>
 #include <linux/module.h>
 #include "net_driver.h"
@@ -554,7 +555,7 @@  int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac)
 	return 0;
 
 fail:
-	memset(vf->mac, 0, ETH_ALEN);
+	eth_zero_addr(vf->mac);
 	return rc;
 }