From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [RFC PATCH 04/10] net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock Date: Fri, 9 Feb 2018 22:04:59 +0100 Message-ID: <20180209210459.GC2079@lunn.ch> References: <1517694016-6692-1-git-send-email-andrew@lunn.ch> <1517694016-6692-5-git-send-email-andrew@lunn.ch> <20180209203336.fqkuliaqmonl67jg@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev , Florian Fainelli , Vivien Didelot , sean.wang@mediatek.com, Woojung.Huh@microchip.com, john@phrozen.org, jbe@pengutronix.de, Brandon Streiff To: Richard Cochran Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:49967 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750993AbeBIVFE (ORCPT ); Fri, 9 Feb 2018 16:05:04 -0500 Content-Disposition: inline In-Reply-To: <20180209203336.fqkuliaqmonl67jg@localhost> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Feb 09, 2018 at 12:33:36PM -0800, Richard Cochran wrote: > On Sat, Feb 03, 2018 at 10:40:08PM +0100, Andrew Lunn wrote: > > +static int mv88e6xxx_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) > > +{ > > + struct mv88e6xxx_chip *chip = ptp_to_chip(ptp); > > + int neg_adj = 0; > > + u32 diff, mult; > > + u64 adj; > > + > > + if (scaled_ppm < 0) { > > + neg_adj = 1; > > + scaled_ppm = -scaled_ppm; > > + } > > + mult = CC_MULT; > > + adj = scaled_ppm * CC_MULT_NUM; > ^^^^^^^^^^^^^^^^^^^^^^^^ > This easily overflows on 32 bit platforms. My bad. Fix below... Hi Richard Thanks, i will squash the fix in for the next version. Andrew