diff mbox series

[v3,6/6] dpaa2-eth: fix a build warning in dpmac.c

Message ID 20200916120830.11456-7-yangbo.lu@nxp.com
State Changes Requested
Delegated to: David Miller
Headers show
Series dpaa2_eth: support 1588 one-step timestamping | expand

Commit Message

Yangbo Lu Sept. 16, 2020, 12:08 p.m. UTC
Fix below sparse warning in dpmac.c.
warning: cast to restricted __le64

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v3:
	- Added this patch.
---
 drivers/net/ethernet/freescale/dpaa2/dpmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yangbo Lu Sept. 18, 2020, 8:59 a.m. UTC | #1
Hi Ioana,

> -----Original Message-----
> From: Ioana Ciornei <ioana.ciornei@nxp.com>
> Sent: Wednesday, September 16, 2020 10:33 PM
> To: Y.b. Lu <yangbo.lu@nxp.com>; netdev@vger.kernel.org
> Cc: Y.b. Lu <yangbo.lu@nxp.com>; David S . Miller <davem@davemloft.net>;
> Jakub Kicinski <kuba@kernel.org>; Ioana Ciocoi Radulescu
> <ruxandra.radulescu@nxp.com>; Richard Cochran
> <richardcochran@gmail.com>
> Subject: RE: [v3, 6/6] dpaa2-eth: fix a build warning in dpmac.c
> 
> 
> > Subject: [v3, 6/6] dpaa2-eth: fix a build warning in dpmac.c
> >
> > Fix below sparse warning in dpmac.c.
> > warning: cast to restricted __le64
> >
> > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > ---
> > Changes for v3:
> > 	- Added this patch.
> > ---
> >  drivers/net/ethernet/freescale/dpaa2/dpmac.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac.c
> > b/drivers/net/ethernet/freescale/dpaa2/dpmac.c
> > index d5997b6..71f165c 100644
> > --- a/drivers/net/ethernet/freescale/dpaa2/dpmac.c
> > +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac.c
> > @@ -177,7 +177,7 @@ int dpmac_get_counter(struct fsl_mc_io *mc_io,
> u32
> > cmd_flags, u16 token,
> >  		return err;
> >
> >  	dpmac_rsp = (struct dpmac_rsp_get_counter *)cmd.params;
> > -	*value = le64_to_cpu(dpmac_rsp->counter);
> > +	*value = dpmac_rsp->counter;
> >
> 
> Hi Yangbo,
> 
> The proper fix for this is to define as __le64 the counter in the
> dpmac_rsp_get_counter structure as below:
> 
> --- a/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h
> @@ -67,7 +67,7 @@ struct dpmac_cmd_get_counter {
> 
>  struct dpmac_rsp_get_counter {
>         u64 pad;
> -       u64 counter;
> +       __le64 counter;
>  };
> 
> Also, if you feel like this is not really part of the series I can take it and send the
> patch separately.

Thank you. Let me send the fix for v2 separately.

> 
> Thanks,
> Ioana
> 
> >  	return 0;
> >  }
> > --
> > 2.7.4
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac.c b/drivers/net/ethernet/freescale/dpaa2/dpmac.c
index d5997b6..71f165c 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpmac.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpmac.c
@@ -177,7 +177,7 @@  int dpmac_get_counter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
 		return err;
 
 	dpmac_rsp = (struct dpmac_rsp_get_counter *)cmd.params;
-	*value = le64_to_cpu(dpmac_rsp->counter);
+	*value = dpmac_rsp->counter;
 
 	return 0;
 }