RE: [patch] extcon: use correct size

From: 김재원
Date: Thu Feb 04 2016 - 21:09:59 EST


Hi, Dan


02/05/2016 04:53 AM에 Dan Carpenter wrote:
>
> On Thu, Feb 04, 2016 at 01:47:41PM +0100, walter harms wrote:
> >
> >
> > Am 04.02.2016 12:36, schrieb Dan Carpenter:
> > > The info->status[] array has 3 elements. We are using size
> > > MAX77843_MUIC_IRQ_NUM (16) instead of MAX77843_MUIC_STATUS_NUM (3)
> > > as intended.
> > >
> > > Fixes: 135d9f7d135a ('extcon: max77843: Clear IRQ bits state
> > > before request IRQ')
> > > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > > ---
> > > This is from static analysis and *NOT TESTED*. Please review
carefully.
> > >
> > > diff --git a/drivers/extcon/extcon-max77843.c
> > > b/drivers/extcon/extcon-max77843.c
> > > index 7bbc300..b188bd6 100644
> > > --- a/drivers/extcon/extcon-max77843.c
> > > +++ b/drivers/extcon/extcon-max77843.c
> > > @@ -806,7 +806,7 @@ static int max77843_muic_probe(struct
platform_device *pdev)
> > > /* Clear IRQ bits before request IRQs */
> > > ret = regmap_bulk_read(max77843->regmap_muic,
> > > MAX77843_MUIC_REG_INT1, info->status,
> > > - MAX77843_MUIC_IRQ_NUM);
> > > + MAX77843_MUIC_STATUS_NUM);
> > > if (ret) {
> > > dev_err(&pdev->dev, "Failed to Clear IRQ bits\n");
> > > goto err_muic_irq;
> > > --
> >
> >
> > just for my curiosity: what is wrong with ARRAY_SIZE() ?
> > So far i understand is the functions intention to fill the array
> > completely.
>
> It's done pretty consistently the one way... Jaewon?
>
> regards,
> dan carpenter
>

You are right.
We should read only 3-sequential register.
(MAX77843_MUIC_REG_INT1, MAX77843_MUIC_REG_INT2, MAX77843_MUIC_REG_INT3)

Reviewed-by: Jaewon Kim <jaewon02.kim@xxxxxxxxxxx>

Thanks
Jaewon Kim