Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3003129rdh; Wed, 27 Sep 2023 22:25:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHV+PwCjqwkldTqzfJzMZ6dnFm+yZoofJ/JWDaeYBrVm3+YCK9iqDflFu53zm/olcDms75u X-Received: by 2002:a05:6a20:918a:b0:15a:f4e:620e with SMTP id v10-20020a056a20918a00b0015a0f4e620emr253536pzd.59.1695878727031; Wed, 27 Sep 2023 22:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695878727; cv=none; d=google.com; s=arc-20160816; b=Td3tteNVVD7jqzH7IsnKtmDVHQp3h3sc8liXxlhXjQaHPoTqpFFUVVfd5DcpZ3bPQ4 6txWcJhE4KsNAiVP4XK5W0ysktQEpu6FZN0BS7+4HbWN/bPyn7yTeD/MseK+lNorF8Po MUPcB5jMG/62TZkESSGn0lL9bILkCQXZIYqCiHK1XQro8eTkvhfr3uZzM2dXdESjXlLR L6ZW6ryvnbLv01LckLZhENFFEZOCjQpg3x4yXCNpi6xW1lMGIzohRocdRorlIH5VMmkM zZBd8Dvyplpl2yqSLf7K7jlD13pKDdoM//FFPLC3NYZxPW1BpGOdfstu6wsUTl7jPsgh PsUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=K5LYNUETcp0qOAJpxVYNrqfYgPjTj2D48kgaIAy23YY=; fh=CQnetQ+Eiejmf9EpxwE3hAsDfBQ8VqsfvX6v9xZUPi8=; b=HsIbGfwf5zwj1LkvrWZDg7TjX9NuWni+GSOwJ6b0HkD8oSBhAy2xytWtZ7pvOIHd0Y GbFqiGJRSR7nLaEwIdgqnnkHpHEFlc4G2KSs+R/nLnrnfXo0SioMFISx7FdL2p6TQBhZ f0J62fBBhdnA9Psv6hV0fxJhDc68XBESJmgBg+9ANY6F4c9yMiPlvl0zwbZGnYnacoHw BORF87I+ZBK1mAposhxJxSbabY3PTyCF0mtSu3M1LqcU6VE8pJzAltF6Wa8yqGEvExb2 CFuJWB1o9fjfPFDsCnAdtS7SEUFiHwuL1miuVTrcEmpIpEvBTvhqnlWidCiuRnr+fhl2 MLYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=YUSISq9C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id h7-20020a170902f54700b001c3e9b0bae1si18820098plf.443.2023.09.27.22.25.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 22:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=YUSISq9C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8AB9F80B3B61; Wed, 27 Sep 2023 22:24:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230047AbjI1FXs (ORCPT + 99 others); Thu, 28 Sep 2023 01:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjI1FXr (ORCPT ); Thu, 28 Sep 2023 01:23:47 -0400 Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 448A3122 for ; Wed, 27 Sep 2023 22:23:45 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id ljUtq9EaLa6PDljUtqdzVs; Thu, 28 Sep 2023 07:23:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1695878623; bh=K5LYNUETcp0qOAJpxVYNrqfYgPjTj2D48kgaIAy23YY=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=YUSISq9Cl/SHiLrMnGRgXt+HQoS/XFHpvOinBwhI22S0oSSdgX/T4VroXIp0CjlKC CVyQhT1BdBQgkobw8JuPpeTsNJ+/AzBDCbIUtGQv/2dx76g61Mvk9XvVNYOWcA6JBJ fTFZsbpJ976wxWKyWlQbvE+piOv1hu3QX7FVV82I3KW8ajUJDrX2OoFhsmSvlDqdtD wpq5NnjxUe0MhnoSEhwH/R0/iKC1qZsR0yQm9EG4dx8B9rBOEvwTGIAcyrVvRASiII kbHFtbz0YDCbieuosQBpbB00+UqVlSiWNvqfpm+aRLcTSsPB7Ml2eRLv5u2Uj3GOeo CutG4094UGBGw== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 28 Sep 2023 07:23:43 +0200 X-ME-IP: 86.243.2.178 Message-ID: <89351ef6-ab81-c679-4432-cc44de9a91f1@wanadoo.fr> Date: Thu, 28 Sep 2023 07:23:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 3/5] power: supply: rt5033_charger: fix missing unlock Content-Language: fr To: Jakob Hauser , Sebastian Reichel Cc: Lee Jones , Stephen Rothwell , Yang Yingliang , Stephan Gerhold , Raymond Hackley , Henrik Grimler , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht References: From: Marion & Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 22:24:05 -0700 (PDT) Ok, but why not already in patch #1? CJ Le 27/09/2023 à 22:26, Jakob Hauser a écrit : > From: Yang Yingliang > > Fix missing mutex_unlock() in some error path. > > Fixes: 12cc585f36b8 ("power: supply: rt5033_charger: Add cable detection and USB OTG supply") > Signed-off-by: Yang Yingliang > Signed-off-by: Jakob Hauser > --- > drivers/power/supply/rt5033_charger.c | 28 ++++++++++++++++++--------- > 1 file changed, 19 insertions(+), 9 deletions(-) > > diff --git a/drivers/power/supply/rt5033_charger.c b/drivers/power/supply/rt5033_charger.c > index 2c2073b8979d..091ca4a21f29 100644 > --- a/drivers/power/supply/rt5033_charger.c > +++ b/drivers/power/supply/rt5033_charger.c > @@ -361,7 +361,8 @@ static int rt5033_charger_set_otg(struct rt5033_charger *charger) > 0x37 << RT5033_CHGCTRL2_CV_SHIFT); > if (ret) { > dev_err(charger->dev, "Failed set OTG boost v_out\n"); > - return -EINVAL; > + ret = -EINVAL; > + goto out_unlock; > } > > /* Set operation mode to OTG */ > @@ -369,7 +370,8 @@ static int rt5033_charger_set_otg(struct rt5033_charger *charger) > RT5033_CHGCTRL1_MODE_MASK, RT5033_BOOST_MODE); > if (ret) { > dev_err(charger->dev, "Failed to update OTG mode.\n"); > - return -EINVAL; > + ret = -EINVAL; > + goto out_unlock; > } > > /* In case someone switched from charging to OTG directly */ > @@ -378,9 +380,10 @@ static int rt5033_charger_set_otg(struct rt5033_charger *charger) > > charger->otg = true; > > +out_unlock: > mutex_unlock(&charger->lock); > > - return 0; > + return ret; > } > > static int rt5033_charger_unset_otg(struct rt5033_charger *charger) > @@ -420,8 +423,10 @@ static int rt5033_charger_set_charging(struct rt5033_charger *charger) > /* In case someone switched from OTG to charging directly */ > if (charger->otg) { > ret = rt5033_charger_unset_otg(charger); > - if (ret) > + if (ret) { > + mutex_unlock(&charger->lock); > return -EINVAL; > + } > } > > charger->online = true; > @@ -448,6 +453,7 @@ static int rt5033_charger_set_mivr(struct rt5033_charger *charger) > RT5033_CHGCTRL4_MIVR_MASK, RT5033_CHARGER_MIVR_4600MV); > if (ret) { > dev_err(charger->dev, "Failed to set MIVR level.\n"); > + mutex_unlock(&charger->lock); > return -EINVAL; > } > > @@ -463,7 +469,7 @@ static int rt5033_charger_set_mivr(struct rt5033_charger *charger) > > static int rt5033_charger_set_disconnect(struct rt5033_charger *charger) > { > - int ret; > + int ret = 0; > > mutex_lock(&charger->lock); > > @@ -475,7 +481,8 @@ static int rt5033_charger_set_disconnect(struct rt5033_charger *charger) > RT5033_CHARGER_MIVR_DISABLE); > if (ret) { > dev_err(charger->dev, "Failed to disable MIVR.\n"); > - return -EINVAL; > + ret = -EINVAL; > + goto out_unlock; > } > > charger->mivr_enabled = false; > @@ -483,16 +490,19 @@ static int rt5033_charger_set_disconnect(struct rt5033_charger *charger) > > if (charger->otg) { > ret = rt5033_charger_unset_otg(charger); > - if (ret) > - return -EINVAL; > + if (ret) { > + ret = -EINVAL; > + goto out_unlock; > + } > } > > if (charger->online) > charger->online = false; > > +out_unlock: > mutex_unlock(&charger->lock); > > - return 0; > + return ret; > } > > static enum power_supply_property rt5033_charger_props[] = {