From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756666AbbGGMk6 (ORCPT ); Tue, 7 Jul 2015 08:40:58 -0400 Received: from mail-wg0-f54.google.com ([74.125.82.54]:34263 "EHLO mail-wg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756912AbbGGMkt (ORCPT ); Tue, 7 Jul 2015 08:40:49 -0400 Message-ID: <1436272845.2190.3.camel@linaro.org> Subject: Re: [PATCH 1/2] extcon: fix hang and extcon_get/set_cable_state(). From: "Ivan T. Ivanov" To: Roger Quadros Cc: cw00.choi@samsung.com, linux-omap@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Date: Tue, 07 Jul 2015 15:40:45 +0300 In-Reply-To: <1436194018-18696-2-git-send-email-rogerq@ti.com> References: <1436194018-18696-1-git-send-email-rogerq@ti.com> <1436194018-18696-2-git-send-email-rogerq@ti.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.13.7-fta1.2~trusty Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2015-07-06 at 17:46 +0300, Roger Quadros wrote: > > -static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) > +static int find_cable_id_by_name(struct extcon_dev *edev, const char *name) > { > - unsigned int id = EXTCON_NONE; > + unsigned int id = -EINVAL; > int i = 0; > > - if (edev->max_supported == 0) > - return -EINVAL; > - > - /* Find the the number of extcon cable */ > + /* Find the id of extcon cable */ > while (extcon_name[i]) { > if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) { > id = i; > @@ -140,6 +137,19 @@ static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) > } > } > Thank you Roger, but this still hang. 'i' is not incremented. Ivan > + return id; > +}; >