Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753550AbbGFSJv (ORCPT ); Mon, 6 Jul 2015 14:09:51 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:45705 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751769AbbGFSJt (ORCPT ); Mon, 6 Jul 2015 14:09:49 -0400 Date: Mon, 6 Jul 2015 13:09:21 -0500 From: Felipe Balbi To: Michael Trimarchi CC: Felipe Balbi , linux-arm-kernel , , Tony Lindgren , Linux Kernel Mailing List , , Linux OMAP Mailing List , Tony Lindgren Subject: Re: [PATCH] base: power: wakeirq: don't leak dev->power.wakeirq Message-ID: <20150706180921.GF20779@saruman.tx.rr.com> Reply-To: References: <1436205678-31640-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fCcDWlUEdh43YKr8" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2731 Lines: 77 --fCcDWlUEdh43YKr8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 06, 2015 at 08:06:17PM +0200, Michael Trimarchi wrote: > Hi >=20 > On Jul 6, 2015 8:01 PM, "Felipe Balbi" wrote: > > > > on a first call to dev_pm_attach_wake_irq(), if it > > fails, it will leave dev->power.wakeirq set to a > > dangling pointer. Instead, let's clear it to make > > sure a subsequent call to dev_pm_attach_wake_irq() > > has chance to succeed. > > > > Cc: Tony Lindgren > > Signed-off-by: Felipe Balbi > > --- > > drivers/base/power/wakeirq.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c > > index 7470004ca810..394d250a1ad8 100644 > > --- a/drivers/base/power/wakeirq.c > > +++ b/drivers/base/power/wakeirq.c > > @@ -50,9 +50,16 @@ static int dev_pm_attach_wake_irq(struct device *dev, > int irq, > > > > err =3D device_wakeup_attach_irq(dev, wirq); > > if (err) > > - return err; > > + goto err_cleanup; > > > > return 0; > > + > > +err_cleanup: > > + spin_lock_irqsave(&dev->power.lock, flags); > > + dev->power.wakeirq =3D NULL; > > + spin_unlock_irqrestore(&dev->power.lock, flags); > > + >=20 > Why here and not in the fuction that return the error? because the field was set here, why would I clear it elsewhere ? --=20 balbi --fCcDWlUEdh43YKr8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVmsRRAAoJEIaOsuA1yqREdfQP/RjW1X7z4DQUe/VmwskYs8or QZ2D+a0F9j1kvji34ab+kx0qNrI9LPaESFo3wZVsCunN5oeGEYM4Ro6LVyIWuGib gemGqb6TzZSkdBzT7IAj0gaqkcz+lXUDUu+UdOl8HuxkNkI54JmgaIUs7wE7UN/x i670J/xgIGHQMntMMvGnTJi4FUzVadB+1fgVNXLlAY+Z14iTS7Yuu0blAHvrvy0v //JRdu1z9XijD0kFvVgMXczeua6xWxlSFS1YMofjFpKbnlg/DTKKFFd4rlpUo+5Z qGDCQ2LCYY5sQzBAhlJPg556lPoedbsuObezQjXcfIkDh99fL+dzTHwsld7rgbeP yNJ4GVUdJSpOyVAPYTphdeEH0baqm4eokUdIi9TL/LB8UNnvetzKbjBXCkxB0R7d rmOf3P+RSI1jYbK0/ugGyHsNEp/hCdDD1MjxmgFnKFRiUtyddE/sszlnRWVehrix SpPsWifHkhOMOnOdHaHyLaOXZBHnFRhStYfxnfJJgD7Oa/9iMERfQdW+b05tl3md 1pgt0S2lTwgMWuzyk4ULOn+7yhRyCSOmi6lcMpiP4bUq80jsDwZeYEpLc3EV58qq D0Xi1iBpxMbP+dT6zWa9LODyZMdSrW1qFbXxcxW1FTjQcKabgFDB6qZaWehDxJsX e/R6cVHLxvAzqM0+9ib4 =DPPe -----END PGP SIGNATURE----- --fCcDWlUEdh43YKr8-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/