[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMo8BfLwhVPgWYf4SOFkqRJC7tLHNnoT15W5nvE3gLM6iEDkqw@mail.gmail.com>
Date: Tue, 30 Nov 2021 06:44:00 -0800
From: Max Filippov <jcmvbkbc@...il.com>
To: Randy Dunlap <rdunlap@...radead.org>
Cc: netdev <netdev@...r.kernel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Chris Zankel <chris@...kel.net>,
"open list:TENSILICA XTENSA PORT (xtensa)"
<linux-xtensa@...ux-xtensa.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH 1/2 -net] natsemi: xtensa: allow writing to const dev_addr array
Hi Randy,
On Mon, Nov 29, 2021 at 10:39 PM Randy Dunlap <rdunlap@...radead.org> wrote:
>
> Let the compiler know that it's ok to write to this const field.
>
> Fixes these build errors:
>
> ../drivers/net/ethernet/natsemi/xtsonic.c: In function 'sonic_probe1':
> ../drivers/net/ethernet/natsemi/xtsonic.c:166:36: error: assignment of read-only location '*(dev->dev_addr + (sizetype)(i * 2))'
> 166 | dev->dev_addr[i*2] = val;
> ../drivers/net/ethernet/natsemi/xtsonic.c:167:38: error: assignment of read-only location '*(dev->dev_addr + ((sizetype)(i * 2) + 1))'
> 167 | dev->dev_addr[i*2+1] = val >> 8;
>
> Fixes: 74f2a5f0ef64 ("xtensa: Add support for the Sonic Ethernet device for the XT2000 board.")
I don't think the original code was broken. But the change
adeef3e32146 ("net: constify netdev->dev_addr")
stated that all users of net_device::dev_addr were converted
to use helpers which is not correct.
> Signed-off-by: Randy Dunlap <rdunlap@...radead.org>
> Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
> Cc: Chris Zankel <chris@...kel.net>
> Cc: Max Filippov <jcmvbkbc@...il.com>
> Cc: linux-xtensa@...ux-xtensa.org
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Jakub Kicinski <kuba@...nel.org>
> ---
> drivers/net/ethernet/natsemi/xtsonic.c | 7 ++++---
There's also jazzsonic.c in this directory with the same pattern
in it. I've posted another patch that fixes them both using helper
function, as I guess was originally intended, here:
https://lore.kernel.org/lkml/20211130143600.31970-1-jcmvbkbc@gmail.com/
--
Thanks.
-- Max
Powered by blists - more mailing lists