lkml.org 
[lkml]   [2018]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mfd: tps65911-comparator: Fix an off by one bug
On Fri, Apr 20, 2018 at 09:39:09AM +0100, Lee Jones wrote:
> On Fri, 20 Apr 2018, Dan Carpenter wrote:
>
> > On Fri, Apr 20, 2018 at 09:09:43AM +0100, Lee Jones wrote:
> > > On Thu, 19 Apr 2018, Dan Carpenter wrote:
> > >
> > > > The tps_comparators[] array is used in two places. We only access the
> > > > COMP1 (1) and COMP2 (2) elements. Unfortunately, we're accessing the
> > > > wrong elements and also one element beyond the end of the array. There
> > > > was supposed to be a zero element at the start of the array which is
> > > > isn't accessed but makes the math work out nicely.
> > >
> > > I normally just apply patches from you, but this is a hack, right?
> >
> > I liked it, I thought it was nice. It uses 32 bytes but any fix was
> > going to use *some* memory. I don't have strong feelings about it
> > though, if you want to write a different patch I can do that instead.
>
> #define COMP 0
> #define COMP1 1
> #define COMP2 2
>
> It's unclear what the defines mean, but if COMP really does exist (is
> there a datasheet for this device?) then your solution is a suitable
> one. However, if there is a COMP, then why isn't it used?
>
> If it doesn't actually exist then this would be more appropriate
> change I think:
>
> #define COMP1 0
> #define COMP2 1
>

I hate to define something_one as zero... Let me send a different
patch for this and see what you think.

regards,
dan carpenter

\
 
 \ /
  Last update: 2018-04-20 11:01    [W:0.077 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site