From: Joe Perches <joe@perches.com>
To: Martin Kaiser <martin@kaiser.cx>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
Phillip Potter <phil@philpotter.co.uk>,
Michael Straube <straube.linux@gmail.com>,
Pavel Skripkin <paskripkin@gmail.com>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 07/14] staging: r8188eu: use memcpy for fallback mac address
Date: Tue, 12 Jul 2022 09:28:59 -0700 [thread overview]
Message-ID: <ae73d34782af7863e4b18495c0588a8cc2162612.camel@perches.com> (raw)
In-Reply-To: <20220709171000.180481-8-martin@kaiser.cx>
On Sat, 2022-07-09 at 19:09 +0200, Martin Kaiser wrote:
> Use memcpy to store the fallback mac address in eeprom->mac_addr. Do not
> copy byte by byte.
[]
> diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
[]
> @@ -912,13 +912,11 @@ unsigned int rtl8188eu_inirp_init(struct adapter *Adapter)
>
> static void Hal_EfuseParseMACAddr_8188EU(struct adapter *adapt, u8 *hwinfo, bool AutoLoadFail)
> {
> - u16 i;
> u8 sMacAddr[6] = {0x00, 0xE0, 0x4C, 0x81, 0x88, 0x02};
static const sMacAddr[ETH_ALEN] = {...};
But maybe this should use eth_random_addr instead as there might
be more than one of these in a network.
> struct eeprom_priv *eeprom = &adapt->eeprompriv;
>
> if (AutoLoadFail) {
> - for (i = 0; i < 6; i++)
> - eeprom->mac_addr[i] = sMacAddr[i];
> + memcpy(eeprom->mac_addr, sMacAddr, ETH_ALEN);
> } else {
> /* Read Permanent MAC address */
> memcpy(eeprom->mac_addr, &hwinfo[EEPROM_MAC_ADDR_88EU], ETH_ALEN);
So perhaps something like:
{
static const u8 sMacAddr[ETH_ALEN] = {
0x00, 0xE0, 0x4C, 0x81, 0x88, 0x02
};
/* Not ether_addr_copy - EEPROM_MAC_ADDR_88EU isn't __aligned(2) */
memcpy(adapt->eeprompriv.mac_addr,
AutoLoadFail ? sMacAddr : &hwinfo[EEPROM_MAC_ADDR_88EU],
ETH_ALEN);
}
or maybe:
{
if (AutoLoadFail)
eth_random_addr(adapt->eeprompriv.mac_addr);
else
memcpy(adapt->eeprompriv.mac_addr,
&hwinfo[EEPROM_MAC_ADDR_88EU], ETH_ALEN);
next prev parent reply other threads:[~2022-07-12 16:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-09 17:09 [PATCH 00/14] clean up efuse reading Martin Kaiser
2022-07-09 17:09 ` [PATCH 01/14] staging: r8188eu: remove unused eeprom defines Martin Kaiser
2022-07-09 17:09 ` [PATCH 02/14] staging: r8188eu: remove EepromOrEfuse from struct eeprom_priv Martin Kaiser
2022-07-09 17:09 ` [PATCH 03/14] staging: r8188eu: remove eeprom function prototypes Martin Kaiser
2022-07-09 17:09 ` [PATCH 04/14] staging: r8188eu: merge EFUSE_ShadowMapUpdate with its caller Martin Kaiser
2022-07-09 17:09 ` [PATCH 05/14] staging: r8188eu: use a local buffer for efuse data Martin Kaiser
2022-07-12 12:25 ` Dan Carpenter
2022-07-12 13:45 ` Larry Finger
2022-07-09 17:09 ` [PATCH 06/14] staging: r8188eu: always initialise efuse buffer with 0xff Martin Kaiser
2022-07-09 17:09 ` [PATCH 07/14] staging: r8188eu: use memcpy for fallback mac address Martin Kaiser
2022-07-12 16:28 ` Joe Perches [this message]
2022-07-09 17:09 ` [PATCH 08/14] staging: r8188eu: merge ReadEFuseByIC into rtl8188e_ReadEFuse Martin Kaiser
2022-07-09 17:09 ` [PATCH 09/14] staging: r8188eu: txpktbuf_bndy is always 0 Martin Kaiser
2022-07-09 17:09 ` [PATCH 10/14] staging: r8188eu: offset is always 0 in rtl8188e_ReadEFuse Martin Kaiser
2022-07-09 17:09 ` [PATCH 11/14] staging: r8188eu: offset is always 0 in iol_read_efuse Martin Kaiser
2022-07-09 17:09 ` [PATCH 12/14] staging: r8188eu: _offset is always 0 in efuse_phymap_to_logical Martin Kaiser
2022-07-09 17:09 ` [PATCH 13/14] staging: r8188eu: efuse_utilized is never read Martin Kaiser
2022-07-09 17:10 ` [PATCH 14/14] staging: r8188eu: the bcnhead parameter is always 0 Martin Kaiser
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=ae73d34782af7863e4b18495c0588a8cc2162612.camel@perches.com \
--to=joe@perches.com \
--cc=Larry.Finger@lwfinger.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=martin@kaiser.cx \
--cc=paskripkin@gmail.com \
--cc=phil@philpotter.co.uk \
--cc=straube.linux@gmail.com \
/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