linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power_supply: generic-adc-battery: Fix checking if none of the channels are supported
@ 2013-05-24 17:41 Axel Lin
  2013-05-28  6:27 ` anish singh
  0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2013-05-24 17:41 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: Anish Kumar, linux-kernel

If none of the channels are supported, index is 0.
Also ensure to return error code instead of 0 in goto second_mem_fail path.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/power/generic-adc-battery.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c
index 8cb5d7f..59a1421 100644
--- a/drivers/power/generic-adc-battery.c
+++ b/drivers/power/generic-adc-battery.c
@@ -299,8 +299,10 @@ static int gab_probe(struct platform_device *pdev)
 	}
 
 	/* none of the channels are supported so let's bail out */
-	if (index == ARRAY_SIZE(gab_chan_name))
+	if (index == 0) {
+		ret = -ENODEV;
 		goto second_mem_fail;
+	}
 
 	/*
 	 * Total number of properties is equal to static properties
-- 
1.8.1.2




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

* Re: [PATCH] power_supply: generic-adc-battery: Fix checking if none of the channels are supported
  2013-05-24 17:41 [PATCH] power_supply: generic-adc-battery: Fix checking if none of the channels are supported Axel Lin
@ 2013-05-28  6:27 ` anish singh
  2013-06-07  0:34   ` Anton Vorontsov
  0 siblings, 1 reply; 3+ messages in thread
From: anish singh @ 2013-05-28  6:27 UTC (permalink / raw)
  To: Axel Lin; +Cc: Anton Vorontsov, linux-kernel-mail

On Fri, May 24, 2013 at 11:11 PM, Axel Lin <axel.lin@ingics.com> wrote:
> If none of the channels are supported, index is 0.
> Also ensure to return error code instead of 0 in goto second_mem_fail path.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: anish kumar <anish198519851985@gmail.com>

I think anton would have already picked up.
> ---
>  drivers/power/generic-adc-battery.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c
> index 8cb5d7f..59a1421 100644
> --- a/drivers/power/generic-adc-battery.c
> +++ b/drivers/power/generic-adc-battery.c
> @@ -299,8 +299,10 @@ static int gab_probe(struct platform_device *pdev)
>         }
>
>         /* none of the channels are supported so let's bail out */
> -       if (index == ARRAY_SIZE(gab_chan_name))
> +       if (index == 0) {
> +               ret = -ENODEV;
>                 goto second_mem_fail;
> +       }
>
>         /*
>          * Total number of properties is equal to static properties
> --
> 1.8.1.2
>
>
>

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

* Re: [PATCH] power_supply: generic-adc-battery: Fix checking if none of the channels are supported
  2013-05-28  6:27 ` anish singh
@ 2013-06-07  0:34   ` Anton Vorontsov
  0 siblings, 0 replies; 3+ messages in thread
From: Anton Vorontsov @ 2013-06-07  0:34 UTC (permalink / raw)
  To: anish singh; +Cc: Axel Lin, linux-kernel-mail

On Tue, May 28, 2013 at 11:57:37AM +0530, anish singh wrote:
> On Fri, May 24, 2013 at 11:11 PM, Axel Lin <axel.lin@ingics.com> wrote:
> > If none of the channels are supported, index is 0.
> > Also ensure to return error code instead of 0 in goto second_mem_fail path.
> >
> > Signed-off-by: Axel Lin <axel.lin@ingics.com>
> Acked-by: anish kumar <anish198519851985@gmail.com>

Applied, thanks!

Anton

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

end of thread, other threads:[~2013-06-07  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24 17:41 [PATCH] power_supply: generic-adc-battery: Fix checking if none of the channels are supported Axel Lin
2013-05-28  6:27 ` anish singh
2013-06-07  0:34   ` Anton Vorontsov

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).