[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201102135119.GI1109407@lunn.ch>
Date: Mon, 2 Nov 2020 14:51:19 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Michal Simek <michal.simek@...inx.com>
Cc: Jakub Kicinski <kuba@...nel.org>, netdev <netdev@...r.kernel.org>,
Radhey Shyam Pandey <radhey.shyam.pandey@...inx.com>
Subject: Re: [PATCH net-next 2/3] drivers: net: xilinx_emaclite: Fix
-Wpointer-to-int-cast warnings with W=1
On Mon, Nov 02, 2020 at 08:20:47AM +0100, Michal Simek wrote:
>
>
> On 31. 10. 20 18:47, Andrew Lunn wrote:
> > drivers/net/ethernet//xilinx/xilinx_emaclite.c:341:35: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> > 341 | addr = (void __iomem __force *)((u32 __force)addr ^
> >
> > Use long instead of u32 to avoid problems on 64 bit systems.
> >
> > Signed-off-by: Andrew Lunn <andrew@...n.ch>
> > ---
> > drivers/net/ethernet/xilinx/xilinx_emaclite.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > index 2c98e4cc07a5..f56c1fd01061 100644
> > --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> > @@ -97,7 +97,7 @@
> > #define ALIGNMENT 4
> >
> > /* BUFFER_ALIGN(adr) calculates the number of bytes to the next alignment. */
> > -#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((u32)adr)) % ALIGNMENT)
> > +#define BUFFER_ALIGN(adr) ((ALIGNMENT - ((long)adr)) % ALIGNMENT)
>
> I can't see any reason to change unsigned type to signed one.
I just found out that the kernel has uintptr_t. I will change it to
that.
> > }
> >
> > dev_info(dev,
> > - "Xilinx EmacLite at 0x%08X mapped to 0x%08X, irq=%d\n",
> > + "Xilinx EmacLite at 0x%08X mapped to 0x%08lX, irq=%d\n",
> > (unsigned int __force)ndev->mem_start,
> > - (unsigned int __force)lp->base_addr, ndev->irq);
> > + (unsigned long __force)lp->base_addr, ndev->irq);
>
> This is different case but I don't think address can be signed type here
> too.
So unsigned long.
Andrew
Powered by blists - more mailing lists