Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2030053ybz; Thu, 30 Apr 2020 09:36:56 -0700 (PDT) X-Google-Smtp-Source: APiQypLLyQFl5qyUBg6ZqYfDBuhWz0xVBl4aoKLSKgxZ36mxgEudYisJeG51qG+o5IMk7xyelUvl X-Received: by 2002:a05:6402:286:: with SMTP id l6mr3593231edv.134.1588264615934; Thu, 30 Apr 2020 09:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588264615; cv=none; d=google.com; s=arc-20160816; b=qRnC/SXfSWs6brDq5dsZLlmDkAwV4PkK1rZyZMb52BI9y00m7dCz0TIlw2CNAxNlmP NjB3ag/WSELp6HcRub/OLALqYFUZ9W766RpN3flB9WcukbFcrekBUj+ECbvzfLadN9oa E8VirBJG5+SxTCCrGQQo///0VIFagBFEhS6uPDuFOkSWXKPJHzLtVOfN7GfJdC5VvqFU xa0QLINweG0IZMeEv+sek8XGWUmuxvyfDJgST0HTwGRDLuqMieD4TwRrneJvClurJu/h cAaKhJdK4UqXQtmEEKmBayuHsFDTGqSxbzeGdS4bSJ6VP8r6xEKa7muUZhWQHVbYUuIb SLwQ== 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=M5abLmX9vuy5PP3FcM1GtjyE9fvZ9YB4lwD/46BWvik=; b=0PFUdx8Lqv6/po8Gth2/i1mzGzf99+j8fVbzNJroPxfzXLosTGqspUAQsmhwQpT9Xn F3Ros2u2xtirYzP4/WnLG1a1ry59H1DGZTeUG9zFPr7IqWuMI3Hbn/r+rUWUITmlu0Cg IXVcUUmIxcO3LKHxNedev2n270q2t3NvPxFQUtxgJO2oejwZQuGKjHparhe3W69FQCmZ XAGFz/6OtDTHu7bYt+kKrFsRBy1Ui+7fzmKwcOpZ7nj0d7gJbF54GZgRB3qqQtoj+cIr 2yxJ/TzyrwqzcqZWpYcBSvVaQ7dRd5836pxuUDEOjttDUlZuqdAAsliGRJ/PIevpIZyo J00Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn25si45914edb.589.2020.04.30.09.36.31; Thu, 30 Apr 2020 09:36:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726431AbgD3QfG (ORCPT + 99 others); Thu, 30 Apr 2020 12:35:06 -0400 Received: from sauhun.de ([88.99.104.3]:53466 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbgD3QfG (ORCPT ); Thu, 30 Apr 2020 12:35:06 -0400 Received: from localhost (p5486CDDB.dip0.t-ipconnect.de [84.134.205.219]) by pokefinder.org (Postfix) with ESMTPSA id A47D92C08FC; Thu, 30 Apr 2020 18:35:03 +0200 (CEST) Date: Thu, 30 Apr 2020 18:35:03 +0200 From: Wolfram Sang To: Alain Volmat , Jarkko Nikula Cc: robh+dt@kernel.org, mark.rutland@arm.com, pierre-yves.mordret@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, fabrice.gasnier@st.com Subject: Re: [PATCH] i2c: fix missing pm_runtime_put_sync in i2c_device_probe Message-ID: <20200430163503.GA15047@ninjato> References: <1588261401-11914-1-git-send-email-alain.volmat@st.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline In-Reply-To: <1588261401-11914-1-git-send-email-alain.volmat@st.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 30, 2020 at 05:43:21PM +0200, Alain Volmat wrote: > In case of the I2C client exposes the flag I2C_CLIENT_HOST_NOTIFY, > pm_runtime_get_sync is called in order to always keep active the > adapter. However later on, pm_runtime_put_sync is never called > within the function in case of an error. This commit add this > error handling. >=20 > Fixes: 72bfcee11cf8 ("i2c: Prevent runtime suspend of adapter when Host N= otify is required") Adding the patch author to CC. > Signed-off-by: Alain Volmat > --- > drivers/i2c/i2c-core-base.c | 22 ++++++++++++++++------ > 1 file changed, 16 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c > index 139aea351ffb..2e4560671183 100644 > --- a/drivers/i2c/i2c-core-base.c > +++ b/drivers/i2c/i2c-core-base.c > @@ -338,8 +338,10 @@ static int i2c_device_probe(struct device *dev) > } else if (ACPI_COMPANION(dev)) { > irq =3D i2c_acpi_get_irq(client); > } > - if (irq =3D=3D -EPROBE_DEFER) > - return irq; > + if (irq =3D=3D -EPROBE_DEFER) { > + status =3D irq; > + goto put_sync_adapter; > + } > =20 > if (irq < 0) > irq =3D 0; > @@ -353,15 +355,19 @@ static int i2c_device_probe(struct device *dev) > */ > if (!driver->id_table && > !i2c_acpi_match_device(dev->driver->acpi_match_table, client) && > - !i2c_of_match_device(dev->driver->of_match_table, client)) > - return -ENODEV; > + !i2c_of_match_device(dev->driver->of_match_table, client)) { > + status =3D -ENODEV; > + goto put_sync_adapter; > + } > =20 > if (client->flags & I2C_CLIENT_WAKE) { > int wakeirq; > =20 > wakeirq =3D of_irq_get_byname(dev->of_node, "wakeup"); > - if (wakeirq =3D=3D -EPROBE_DEFER) > - return wakeirq; > + if (wakeirq =3D=3D -EPROBE_DEFER) { > + status =3D wakeirq; > + goto put_sync_adapter; > + } > =20 > device_init_wakeup(&client->dev, true); > =20 > @@ -408,6 +414,10 @@ static int i2c_device_probe(struct device *dev) > err_clear_wakeup_irq: > dev_pm_clear_wake_irq(&client->dev); > device_init_wakeup(&client->dev, false); > +put_sync_adapter: > + if (client->flags & I2C_CLIENT_HOST_NOTIFY) > + pm_runtime_put_sync(&client->adapter->dev); > + > return status; > } > =20 > --=20 > 2.17.1 >=20 --zYM0uCDKw75PZbzx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl6q/jMACgkQFA3kzBSg KbbwFBAAhtQzzNeB/GCaKLSF1bZD7pXmWBQHwK11H0kJO7UkmEVuRuLNCn250MMa AOmgf8Y27Ij/cb5xcnLfWYpf/c8EKB68QnOawPIpu7P2loT3VwEOcbn3to8yi0WU 42ZJmWshB26DyiqaH6IWbqRNVL5t6qhPtnIbOU84pO5FExppXlB63kShSUKO2gXi kehrRerP6h8hZFYlz0wYSVgBpL/2B4BOydkCGlK4INoGtgIVGPwcrqP557ulqXe4 kTlu3uCeo3aZFfzmoeui+SoXvBPA1PdHOT4HZRs6Pcw1FFOed95JyrVJxSSiKK35 zGBOFjDTA9ZbfROzK3YHZR525uEQkceqGJHrRSpxqrM3o02sZXO/W2j359TbEHB2 PQncp1GAXNePayRakxrd9q8MpBoFRtiRiaGPZVuF9lCof+DERo27cpnINOc4E+Te WnW7QRxjyDguqkDdUZEdDGJ9nX6BO+Yg1OhoBQdjZ9vvnqrYMmRZZCDYNAU13ZLi lzR3mLPoyJMIj2c251mWUaNrm0nHZrw2PAmrNwygyu4MTmaZGxECu725lRNajqeu 1SuXby3l59NU+yKTze5oOhRvsjTP55mgDRVxzTbtnmZNDkE6EgKLsSvHG3PX6wAB YMBYlbSH6QxZ338/XA0Cvkbc4zn5vScALsa0lT6l69wtPPP6obk= =lXSI -----END PGP SIGNATURE----- --zYM0uCDKw75PZbzx--