linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: Anish Kumar <anish198519851985@gmail.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] power_supply: generic-adc-battery: Fix checking if none of the channels are supported
Date: Sat, 25 May 2013 01:41:44 +0800	[thread overview]
Message-ID: <1369417304.9205.1.camel@phoenix> (raw)

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




             reply	other threads:[~2013-05-24 17:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 17:41 Axel Lin [this message]
2013-05-28  6:27 ` [PATCH] power_supply: generic-adc-battery: Fix checking if none of the channels are supported anish singh
2013-06-07  0:34   ` Anton Vorontsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369417304.9205.1.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=anish198519851985@gmail.com \
    --cc=cbouatmailru@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).