From patchwork Thu Oct 20 22:06:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9387685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 83441607D0 for ; Thu, 20 Oct 2016 22:06:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62C7F29CAE for ; Thu, 20 Oct 2016 22:06:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5622D29CB2; Thu, 20 Oct 2016 22:06:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA4C929CAE for ; Thu, 20 Oct 2016 22:06:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754694AbcJTWGl (ORCPT ); Thu, 20 Oct 2016 18:06:41 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32807 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754657AbcJTWGk (ORCPT ); Thu, 20 Oct 2016 18:06:40 -0400 Received: by mail-pf0-f195.google.com with SMTP id i85so6637118pfa.0; Thu, 20 Oct 2016 15:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=i7Ks2o/DHsARk70KKRUDj61ovv2Ht9mjD8NXirXHgKI=; b=hb1cWGvv/etWKeOWAlxaSKKkPDOBnpdFqXIU47iqLzpgtBeQo0gGMlgXlTgVvLsPhy 7sEBeDfRNZy/GJhGXcF6BpjPAucwSZ3PSqDJrq0xwW7IomXolEbRF1t7wRX8qnSVXaUc P/CKXTJqqKRqKovmn14aQ5Qcv+Z0TtGFdDZBE+/2J+aClMDQGpAY6doZUhiMMJe59Z6S 2cwV9kPdBemBLHdR9hH2Z+8/CijJ+2qjI9jiPvcoof1LyCOVm5b65aLVXYTPfJnGxRXN vSAQPRDC+t86kBLVUTyVmzZgoZjPGzqeOdMx9HJ6PgLYNvpJT+CRRKGjxLh16pp3ECPq NzlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=i7Ks2o/DHsARk70KKRUDj61ovv2Ht9mjD8NXirXHgKI=; b=K33rlvikb3PVKaYVjNyalFx0B9QW3ibFPKAvmJmAyCesjimp4Xmsy8XjP7lNGwF+on BnT83L6iCbkibu6ajXMKbe0cHKeJkCojzgZfkQYOC+FYeL5kyztxtaRLA8o10TUe58ue TLLGktS/uTOMBiBNjLiYuGsUl5LVp+qBmZLnxPVEHZ76N/YX4/DZzkJHf392PBhoJaR0 7+SNFaM+7jsRkAkC9DP5OowFQLEZ1lFOS029e3mhuyrHdyrM6FHOhbJX0/nzdEcq0Glp 5G228VnIl9lJXi0A0SnrADHqEb5opnO8u2IUbIz+VxaJtpgFZh9v7RdpJodS8uCAGgvc UyYQ== X-Gm-Message-State: AA6/9RnYlEJn9ow8rb+6p4gvT1dAAlUIRFLNcVSXm+Ov5QG1NzPKfNRlJzyjqVdJMRGGLQ== X-Received: by 10.98.32.82 with SMTP id g79mr5150012pfg.142.1477001199312; Thu, 20 Oct 2016 15:06:39 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1311:95aa:68e5:8624:ab03]) by smtp.gmail.com with ESMTPSA id 133sm65765416pfx.92.2016.10.20.15.06.38 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 20 Oct 2016 15:06:38 -0700 (PDT) Date: Thu, 20 Oct 2016 15:06:36 -0700 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Linus Walleij , Hans de Goede , Mika Westerberg , Geert Uytterhoeven , linux-kernel@vger.kernel.org Subject: [PATCH] Input: gpio_keys_polled - fix DT node reference leak Message-ID: <20161020220636.GA17948@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); return -EINVAL; }