From: Larry Finger <Larry.Finger@lwfinger.net>
To: Heba Aamer <heba93aamer@gmail.com>, devel@driverdev.osuosl.org
Cc: florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org,
tapaswenipathak@gmail.com, thomas@grouk.net,
sudipm.mukherjee@gmail.com,
rickard_strandqvist@spectrumdigital.se,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()
Date: Thu, 29 Jan 2015 20:02:53 -0600 [thread overview]
Message-ID: <54CAE64D.2040703@lwfinger.net> (raw)
In-Reply-To: <20150129221136.GA22253@mohammed-Inspiron-3537>
On 01/29/2015 04:11 PM, Heba Aamer wrote:
> This patch fixes the following checkpatch.pl warning:
> Prefer ether_addr_copy() over memcpy()
> if the Ethernet addresses are __aligned(2)
>
> pahole showed that the struct used pnetdev->dev_addr
> is aligned to u16.
>
> Moreover mac is a simple array, pdata is a pointer that
> starts from an even offset.
>
> Signed-off-by: Heba Aamer <heba93aamer@gmail.com>
> ---
> v2: modifying patch description
>
> drivers/staging/rtl8712/usb_intf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
This is much better.
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Larry
>
> diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
> index 15f0d42..a2f2dfb 100644
> --- a/drivers/staging/rtl8712/usb_intf.c
> +++ b/drivers/staging/rtl8712/usb_intf.c
> @@ -463,7 +463,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
> /* Use the mac address stored in the Efuse
> * offset = 0x12 for usb in efuse
> */
> - memcpy(mac, &pdata[0x12], ETH_ALEN);
> + ether_addr_copy(mac, &pdata[0x12]);
> }
> eeprom_CustomerID = pdata[0x52];
> switch (eeprom_CustomerID) {
> @@ -580,7 +580,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
> } else
> dev_info(&udev->dev,
> "r8712u: MAC Address from efuse = %pM\n", mac);
> - memcpy(pnetdev->dev_addr, mac, ETH_ALEN);
> + ether_addr_copy(pnetdev->dev_addr, mac);
> }
> /* step 6. Load the firmware asynchronously */
> if (rtl871x_load_fw(padapter))
>
prev parent reply other threads:[~2015-01-30 2:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-29 22:11 Heba Aamer
2015-01-30 2:02 ` Larry Finger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54CAE64D.2040703@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=heba93aamer@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rickard_strandqvist@spectrumdigital.se \
--cc=sudipm.mukherjee@gmail.com \
--cc=tapaswenipathak@gmail.com \
--cc=thomas@grouk.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®