[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200224232343.GE1508@skl-build>
Date: Mon, 24 Feb 2020 15:23:43 -0800
From: "Christopher S. Hall" <christopher.s.hall@...el.com>
To: Richard Cochran <richardcochran@...il.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
tglx@...utronix.de, hpa@...or.com, mingo@...hat.com,
x86@...nel.org, jacob.e.keller@...el.com, davem@...emloft.net,
sean.v.kelley@...el.com
Subject: Re: [Intel PMC TGPIO Driver 1/5] drivers/ptp: Add Enhanced handling
of reserve fields
Hi Richard,
Thanks for the detailed review.
On Sun, Feb 02, 2020 at 05:27:00PM -0800, Richard Cochran wrote:
> On Wed, Dec 11, 2019 at 01:48:48PM -0800, christopher.s.hall@...el.com wrote:
> > diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> > index 9d72ab593f13..f9ad6df57fa5 100644
> > --- a/drivers/ptp/ptp_chardev.c
> > +++ b/drivers/ptp/ptp_chardev.c
> > @@ -12,6 +12,7 @@
> > #include <linux/timekeeping.h>
> >
> > #include <linux/nospec.h>
> > +#include <linux/string.h>
>
> Please group these two includes with the others, above, in
> alphabetical order.
OK. Done.
> > #include "ptp_private.h"
> >
> > @@ -106,6 +107,28 @@ int ptp_open(struct posix_clock *pc, fmode_t fmode)
> > return 0;
> > }
> >
> > +/* Returns -1 if any reserved fields are non-zero */
> > +static inline int _check_rsv_field(unsigned int *field, size_t size)
>
> How about _check_reserved_field() instead?
No problem. Sounds good.
> > +{
> > + unsigned int *iter;
>
> Ugh, 'ptr' please.
>
> > + int ret = 0;
> > +
> > + for (iter = field; iter < field+size && ret == 0; ++iter)
> > + ret = *iter == 0 ? 0 : -1;
>
> Please use the "early out" pattern:
>
> for (ptr = field; ptr < field + size; ptr++) {
> if (*ptr) {
> return -1;
> }
> }
> return 0;
>
> Note: field + size
> Note: ptr++
OK for both of these.
> > +
> > + return ret;
> > +}
> > +#define check_rsv_field(field) _check_rsv_field(field, ARRAY_SIZE(field))
>
> And check_reserved_field() here. No need to abbreviate.
OK. Done.
> Thanks,
> Richard
Thanks,
Chris
Powered by blists - more mailing lists