mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim Bird <tim.bird@sonymobile.com>
To: <myungjoo.ham@samsung.com>, <cw00.choi@samsung.com>
Cc: <linux-kernel@vger.kernel.org>, <tbird20d@gmail.com>,
	<tim.bird@sonymobile.com>, <bjorn.andersson@sonymobile.com>
Subject: [PATCH] extcon: add index increment in find_cable_index_by_name
Date: Mon, 10 Aug 2015 10:44:35 -0700	[thread overview]
Message-ID: <1439228675-27616-1-git-send-email-tim.bird@sonymobile.com> (raw)

This fixes a bug introduced by commit 73b6ecdb93e8 ("extcon: Redefine the
unique id of supported external connectors without 'enum extcon' type")
which introduced an infinite loop in find_cable_index_by_name.  That commit
converted the scan from a for loop to a while, but did not increment
'i' anywhere in the loop.  If the loop index is not incremented, the
function never exits.

This function can never work correctly without this fix.

Signed-off-by: Tim Bird <tim.bird@sonymobile.com>
---
 drivers/extcon/extcon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index dda1e62..734a9b1 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -138,6 +138,7 @@ static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
 			id = i;
 			break;
 		}
+		i++;
 	}
 
 	if (id == EXTCON_NONE)
-- 
1.8.2.2


             reply	other threads:[~2015-08-10 17:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 17:44 Tim Bird [this message]
2015-08-10 19:18 ` Tim Bird

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=1439228675-27616-1-git-send-email-tim.bird@sonymobile.com \
    --to=tim.bird@sonymobile.com \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=cw00.choi@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=tbird20d@gmail.com \
    /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

all inboxes | Powered by JetHome®