From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932466AbcJUJCp (ORCPT ); Fri, 21 Oct 2016 05:02:45 -0400 Received: from mga05.intel.com ([192.55.52.43]:17440 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932179AbcJUJCo (ORCPT ); Fri, 21 Oct 2016 05:02:44 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,375,1473145200"; d="scan'208";a="775561857" Date: Fri, 21 Oct 2016 12:02:35 +0300 From: Mika Westerberg To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, Linus Walleij , Hans de Goede , Geert Uytterhoeven , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Input: gpio_keys_polled - fix DT node reference leak Message-ID: <20161021090235.GS24289@lahna.fi.intel.com> References: <20161020220636.GA17948@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161020220636.GA17948@dtor-ws> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 20, 2016 at 03:06:36PM -0700, Dmitry Torokhov wrote: > When someone requests button with wakeup (which this driver does not > support) we should drop reference to the current child device node before > returning error. > > Note that when we using legacy platform data 'child' stays NULL which > fwnode_handle_put() handles just fine. > > Signed-off-by: Dmitry Torokhov > --- > drivers/input/keyboard/gpio_keys_polled.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c > index 270dcf7..72b3503 100644 > --- a/drivers/input/keyboard/gpio_keys_polled.c > +++ b/drivers/input/keyboard/gpio_keys_polled.c > @@ -291,6 +291,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) > > if (button->wakeup) { > dev_err(dev, DRV_NAME " does not support wakeup\n"); > + fwnode_handle_put(child); Are you sure this is the right place? I didn't try to compile this but to me it looks like there is no variable named "child" in the whole gpio_keys_polled_probe() function. Unless I'm looking at wrong branch ;-) > return -EINVAL; > } > > -- > 2.8.0.rc3.226.g39d4020 > > > -- > Dmitry