From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755041AbbHJTSe (ORCPT ); Mon, 10 Aug 2015 15:18:34 -0400 Received: from seldrel01.sonyericsson.com ([37.139.156.2]:11655 "EHLO seldrel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754218AbbHJTSd (ORCPT ); Mon, 10 Aug 2015 15:18:33 -0400 Message-ID: <55C8F903.3040001@sonymobile.com> Date: Mon, 10 Aug 2015 12:18:27 -0700 From: Tim Bird User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: "myungjoo.ham@samsung.com" , "cw00.choi@samsung.com" CC: "linux-kernel@vger.kernel.org" , "tbird20d@gmail.com" , =?windows-1252?Q?=22Andersson=2C_Bj=F6rn=22?= Subject: Re: [PATCH] extcon: add index increment in find_cable_index_by_name References: <1439228675-27616-1-git-send-email-tim.bird@sonymobile.com> In-Reply-To: <1439228675-27616-1-git-send-email-tim.bird@sonymobile.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Never mind... This is already fixed by commit be052cc8 in mainline. Sorry for the noise. -- Tim On 08/10/2015 10:44 AM, Tim Bird wrote: > 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 > --- > 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) >