From patchwork Tue May 10 15:37:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 9059681 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5DC89BF29F for ; Tue, 10 May 2016 15:38:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A304820114 for ; Tue, 10 May 2016 15:38:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94AE2200DF for ; Tue, 10 May 2016 15:38:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718AbcEJPip (ORCPT ); Tue, 10 May 2016 11:38:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57475 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752047AbcEJPiC (ORCPT ); Tue, 10 May 2016 11:38:02 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9058E85541; Tue, 10 May 2016 15:38:01 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-116-134.ams2.redhat.com [10.36.116.134]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4AFbtZ2021875; Tue, 10 May 2016 11:37:59 -0400 From: Benjamin Tissoires To: Dmitry Torokhov , Wei Yongjun Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Bastien Nocera , Alexandre Courbot , Lejun Zhu Subject: [PATCH 1/3] Input - soc_button_array: use gpio_is_valid() Date: Tue, 10 May 2016 17:37:51 +0200 Message-Id: <1462894673-26560-2-git-send-email-benjamin.tissoires@redhat.com> In-Reply-To: <1462894673-26560-1-git-send-email-benjamin.tissoires@redhat.com> References: <1462894673-26560-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 10 May 2016 15:38:01 +0000 (UTC) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gpio_keys will later use gpio_is_valid(). To match the actual behavior, we should use it here too. Signed-off-by: Benjamin Tissoires --- drivers/input/misc/soc_button_array.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index c14b827..9cbe874 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -17,6 +17,7 @@ #include #include #include +#include #include /* @@ -92,7 +93,7 @@ soc_button_device_create(struct platform_device *pdev, continue; gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index); - if (gpio < 0) + if (gpio_is_valid(gpio)) continue; gpio_keys[n_buttons].type = info->event_type;