linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] extcon: use correct size
@ 2016-02-04 11:36 Dan Carpenter
  2016-02-04 12:47 ` walter harms
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-02-04 11:36 UTC (permalink / raw)
  To: MyungJoo Ham, Jaewon Kim; +Cc: Chanwoo Choi, linux-kernel, kernel-janitors

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@oracle.com>
---
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;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [patch] extcon: use correct size
  2016-02-04 11:36 [patch] extcon: use correct size Dan Carpenter
@ 2016-02-04 12:47 ` walter harms
  2016-02-04 19:53   ` Dan Carpenter
  2016-02-05  1:58 ` Krzysztof Kozlowski
  2016-02-05  5:14 ` Chanwoo Choi
  2 siblings, 1 reply; 6+ messages in thread
From: walter harms @ 2016-02-04 12:47 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: MyungJoo Ham, Jaewon Kim, Chanwoo Choi, linux-kernel, kernel-janitors



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@oracle.com>
> ---
> 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.

re,
 wh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] extcon: use correct size
  2016-02-04 12:47 ` walter harms
@ 2016-02-04 19:53   ` Dan Carpenter
  2016-02-05  2:09     ` 김재원
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2016-02-04 19:53 UTC (permalink / raw)
  To: walter harms
  Cc: MyungJoo Ham, Jaewon Kim, Chanwoo Choi, linux-kernel, kernel-janitors

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@oracle.com>
> > ---
> > 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] extcon: use correct size
  2016-02-04 11:36 [patch] extcon: use correct size Dan Carpenter
  2016-02-04 12:47 ` walter harms
@ 2016-02-05  1:58 ` Krzysztof Kozlowski
  2016-02-05  5:14 ` Chanwoo Choi
  2 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2016-02-05  1:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: MyungJoo Ham, Jaewon Kim, Chanwoo Choi, linux-kernel, kernel-janitors

2016-02-04 20:36 GMT+09:00 Dan Carpenter <dan.carpenter@oracle.com>:
> 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@oracle.com>
> ---
> 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;

Looks correct. Issue came from our internal tree where
MAX77843_MUIC_IRQ_NUM is redefined to a value of 3.

However the subject should be fixed to match the subsystem and more
accurately describe the error.

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [patch] extcon: use correct size
  2016-02-04 19:53   ` Dan Carpenter
@ 2016-02-05  2:09     ` 김재원
  0 siblings, 0 replies; 6+ messages in thread
From: 김재원 @ 2016-02-05  2:09 UTC (permalink / raw)
  To: 'Dan Carpenter', 'walter harms'
  Cc: 'MyungJoo Ham', 'Chanwoo Choi',
	linux-kernel, kernel-janitors

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@oracle.com>
> > > ---
> > > 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@samsung.com>

Thanks
Jaewon Kim

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] extcon: use correct size
  2016-02-04 11:36 [patch] extcon: use correct size Dan Carpenter
  2016-02-04 12:47 ` walter harms
  2016-02-05  1:58 ` Krzysztof Kozlowski
@ 2016-02-05  5:14 ` Chanwoo Choi
  2 siblings, 0 replies; 6+ messages in thread
From: Chanwoo Choi @ 2016-02-05  5:14 UTC (permalink / raw)
  To: Dan Carpenter, MyungJoo Ham, Jaewon Kim; +Cc: linux-kernel, kernel-janitors

Hi Dan,

On 2016년 02월 04일 20:36, Dan Carpenter wrote:
> 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@oracle.com>
> ---
> 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;
> 
> 

The patch title should include the correct information
of specific device.

extcon: use correct size
-> extcon: max77843: Use correct size for reading the interrupt register

Applied it.

Thanks,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-05  5:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-04 11:36 [patch] extcon: use correct size Dan Carpenter
2016-02-04 12:47 ` walter harms
2016-02-04 19:53   ` Dan Carpenter
2016-02-05  2:09     ` 김재원
2016-02-05  1:58 ` Krzysztof Kozlowski
2016-02-05  5:14 ` Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).