Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1282211imu; Wed, 28 Nov 2018 07:19:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/W//xupayMEcfZMutzqUJE7947S2BSi+relhJBu698Ky9SK/AxVnKvhYpouy+2NViGD4Cwb X-Received: by 2002:a63:f615:: with SMTP id m21mr34356153pgh.428.1543418383492; Wed, 28 Nov 2018 07:19:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543418383; cv=none; d=google.com; s=arc-20160816; b=Oi6OUgQsDyATwnrOFkIn58og2St+NM917ZHRtRduUvyta522ZxqzLlKNj7KhA5Z9wF eMCn99wXo6bv1QNCRW7cs1qhkdtWlKwaP4NBT3xEz5hnnFPPpqjkSXkv0ED9W4iu6IBc fkVZhtQSsWgAYucfFe2xqk9F0nrZmThkSLDrfI9E0uw67QVFGEA0dydb3pwqdYFeC4i0 il7D1siaqxQa2xZZ3+R8PnqcDDJxT+/vVgELnXOgFz10ZOF5XWH+uGYBN0NVxXj/6oRQ x9fa+N5D0ptsmsDra/vb/eIEeBt1p7Xd7zS5l6JhdQJFESiUSQfckVpTaav4MTwe/ery 1F/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=I8dpRDPNSoBnkq9+xIqnEDBj8qOcwV12XL1jEfpTPg8=; b=cW5ojlh6pElISX6Dqd3ic1GwnYc2WC6To30SecAhFRhHOZeCNRBNjic855eN8zJ+rs Zs/zFIkITX71vUMYFoHCRkAKzGR3P2lNTd1x3pjpK/vWATSX/ancTBjvqywxcCKGqPki swbL7JZd8tXAEA4vq6icwx1Of0mAOy9giR/hvqjpmzJrxaXWLWhZ7bKudPBzpP2swffA tqccYBPgdSa+GRMDgq10PTYNsvBJsLE0vcXNmQvuJT5yXhHGiN8qD73efMydrOKBTVI7 Uqj8boV8PTOfWHRgmlU2/36RjQCIz1vN6to4cgEgFnl/XI08XtvWG6pQ9hIVliPpKAee 2ChQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t75si5517881pfa.170.2018.11.28.07.19.12; Wed, 28 Nov 2018 07:19:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728614AbeK2CTT (ORCPT + 99 others); Wed, 28 Nov 2018 21:19:19 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:33008 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727726AbeK2CTT (ORCPT ); Wed, 28 Nov 2018 21:19:19 -0500 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wASFBreL011746; Wed, 28 Nov 2018 09:17:16 -0600 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail3.cirrus.com ([87.246.76.56]) by mx0a-001ae601.pphosted.com with ESMTP id 2ny4x670q6-1; Wed, 28 Nov 2018 09:17:16 -0600 Received: from EX17.ad.cirrus.com (ex17.ad.cirrus.com [172.20.9.81]) by mail3.cirrus.com (Postfix) with ESMTP id 874BC611C8AF; Wed, 28 Nov 2018 09:20:06 -0600 (CST) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Wed, 28 Nov 2018 15:17:15 +0000 Received: from imbe.wolfsonmicro.main (imbe.wolfsonmicro.main [198.61.95.81]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id wASFHFLg023567; Wed, 28 Nov 2018 15:17:15 GMT Date: Wed, 28 Nov 2018 15:17:15 +0000 From: Charles Keepax To: Linus Walleij CC: Liam Girdwood , Mark Brown , , Bartosz Golaszewski Subject: Re: [PATCH 09/10] regulator: s5m8767: Let core handle GPIO descriptors Message-ID: <20181128151715.GT16508@imbe.wolfsonmicro.main> References: <20181128104350.31902-1-linus.walleij@linaro.org> <20181128104350.31902-10-linus.walleij@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20181128104350.31902-10-linus.walleij@linaro.org> User-Agent: Mutt/1.5.20 (2009-12-10) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=846 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280134 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 28, 2018 at 11:43:49AM +0100, Linus Walleij wrote: > Use the gpiod_get_from_of_node() rather than the devm_* > version so that the regulator core can handle the lifecycle > of these descriptors. > > Introduce an errorpath so we free any retrieved descriptors > properly. > > This patch requires "gpio: Export gpiod_get_from_of_node()" > to be applied first. > > Fixes: 9ae5cc75ceaa ("regulator: s5m8767: Pass descriptor instead of GPIO number") > Signed-off-by: Linus Walleij > --- > drivers/regulator/s5m8767.c | 37 ++++++++++++++++++++++++++----------- > 1 file changed, 26 insertions(+), 11 deletions(-) > @@ -674,6 +681,14 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, > } > > return 0; > + > +err_gpiod_put: > + while (j) { > + gpiod_put(rdata->ext_control_gpiod); > + rdata--; > + j--; > + } > + return ret; > } These looks like it handles the error paths in s5m8767_pmic_dt_parse_pdata, however there are still all the error paths between the call to that function and the call to regulator_register that need to be handled as well. Thanks, Charles