diff mbox series

[net-next] net: fec: ptp: remove unused variable 'ns' in fec_time_keep()

Message ID 1600089264-21910-1-git-send-email-zhangchangzhong@huawei.com
State New
Headers show
Series [net-next] net: fec: ptp: remove unused variable 'ns' in fec_time_keep() | expand

Commit Message

Zhang Changzhong Sept. 14, 2020, 1:14 p.m. UTC
Fixes the following W=1 kernel build warning(s):

drivers/net/ethernet/freescale/fec_ptp.c:523:6: warning:
 variable 'ns' set but not used [-Wunused-but-set-variable]
  523 |  u64 ns;
      |      ^~

After commit 6605b730c061 ("FEC: Add time stamping code and a PTP
hardware clock"), variable 'ns' is never used in fec_time_keep(),
so removing it to avoid build warning.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
---
 drivers/net/ethernet/freescale/fec_ptp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Andy Duan Sept. 14, 2020, 2:35 p.m. UTC | #1
From: Zhang Changzhong <zhangchangzhong@huawei.com> Sent: Monday, September 14, 2020 9:14 PM

> Fixes the following W=1 kernel build warning(s):

> 

> drivers/net/ethernet/freescale/fec_ptp.c:523:6: warning:

>  variable 'ns' set but not used [-Wunused-but-set-variable]

>   523 |  u64 ns;

>       |      ^~

> 

> After commit 6605b730c061 ("FEC: Add time stamping code and a PTP

> hardware clock"), variable 'ns' is never used in fec_time_keep(), so removing it

> to avoid build warning.

> 

> Reported-by: Hulk Robot <hulkci@huawei.com>

> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>


Acked-by: Fugang Duan <fugang.duan@nxp.com>

> ---

>  drivers/net/ethernet/freescale/fec_ptp.c | 3 +--

>  1 file changed, 1 insertion(+), 2 deletions(-)

> 

> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c

> b/drivers/net/ethernet/freescale/fec_ptp.c

> index a0c1f44..0405a39 100644

> --- a/drivers/net/ethernet/freescale/fec_ptp.c

> +++ b/drivers/net/ethernet/freescale/fec_ptp.c

> @@ -520,13 +520,12 @@ static void fec_time_keep(struct work_struct *work)

> {

>  	struct delayed_work *dwork = to_delayed_work(work);

>  	struct fec_enet_private *fep = container_of(dwork, struct

> fec_enet_private, time_keep);

> -	u64 ns;

>  	unsigned long flags;

> 

>  	mutex_lock(&fep->ptp_clk_mutex);

>  	if (fep->ptp_clk_on) {

>  		spin_lock_irqsave(&fep->tmreg_lock, flags);

> -		ns = timecounter_read(&fep->tc);

> +		timecounter_read(&fep->tc);

>  		spin_unlock_irqrestore(&fep->tmreg_lock, flags);

>  	}

>  	mutex_unlock(&fep->ptp_clk_mutex);

> --

> 2.9.5
David Miller Sept. 14, 2020, 8:43 p.m. UTC | #2
From: Zhang Changzhong <zhangchangzhong@huawei.com>
Date: Mon, 14 Sep 2020 21:14:24 +0800

> Fixes the following W=1 kernel build warning(s):
> 
> drivers/net/ethernet/freescale/fec_ptp.c:523:6: warning:
>  variable 'ns' set but not used [-Wunused-but-set-variable]
>   523 |  u64 ns;
>       |      ^~
> 
> After commit 6605b730c061 ("FEC: Add time stamping code and a PTP
> hardware clock"), variable 'ns' is never used in fec_time_keep(),
> so removing it to avoid build warning.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>

Applied.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index a0c1f44..0405a39 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -520,13 +520,12 @@  static void fec_time_keep(struct work_struct *work)
 {
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct fec_enet_private *fep = container_of(dwork, struct fec_enet_private, time_keep);
-	u64 ns;
 	unsigned long flags;
 
 	mutex_lock(&fep->ptp_clk_mutex);
 	if (fep->ptp_clk_on) {
 		spin_lock_irqsave(&fep->tmreg_lock, flags);
-		ns = timecounter_read(&fep->tc);
+		timecounter_read(&fep->tc);
 		spin_unlock_irqrestore(&fep->tmreg_lock, flags);
 	}
 	mutex_unlock(&fep->ptp_clk_mutex);