[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140823195234.GA3878@localhost.localdomain>
Date: Sat, 23 Aug 2014 21:52:34 +0200
From: Richard Cochran <richardcochran@...il.com>
To: Fugang Duan <b38611@...escale.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH v5 1/1] net: fec: ptp: avoid register access when ipg
clock is disabled
On Thu, Aug 21, 2014 at 05:09:38PM +0800, Fugang Duan wrote:
> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
> index 82386b2..cca3617 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -245,12 +245,20 @@ static int fec_ptp_settime(struct ptp_clock_info *ptp,
> u64 ns;
> unsigned long flags;
>
> + mutex_lock(&fep->ptp_clk_mutex);
> + /* Check the ptp clock */
> + if (!fep->ptp_clk_on) {
> + mutex_unlock(&fep->ptp_clk_mutex);
> + return -EINVAL;
> + }
> +
Don't you need the same kind of check in fec_ptp_gettime, too?
> ns = ts->tv_sec * 1000000000ULL;
> ns += ts->tv_nsec;
>
> spin_lock_irqsave(&fep->tmreg_lock, flags);
> timecounter_init(&fep->tc, &fep->cc, ns);
> spin_unlock_irqrestore(&fep->tmreg_lock, flags);
> + mutex_unlock(&fep->ptp_clk_mutex);
> return 0;
> }
>
Thanks,
Richard
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists