From patchwork Fri Jan 15 20:33:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Timo_Ter=C3=A4s?= X-Patchwork-Id: 8044531 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 9AE7FBEEE5 for ; Fri, 15 Jan 2016 20:34:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA12220381 for ; Fri, 15 Jan 2016 20:34:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB82B20395 for ; Fri, 15 Jan 2016 20:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752918AbcAOUd6 (ORCPT ); Fri, 15 Jan 2016 15:33:58 -0500 Received: from mail-lb0-f196.google.com ([209.85.217.196]:33903 "EHLO mail-lb0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752925AbcAOUd5 (ORCPT ); Fri, 15 Jan 2016 15:33:57 -0500 Received: by mail-lb0-f196.google.com with SMTP id oe3so5186444lbb.1 for ; Fri, 15 Jan 2016 12:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=KGs/4HyS9IVS8+vxBeOfRhaPQDLGF77hsoYb7VUPnr4=; b=QgPvoKqwNgatZRSeIlsgNnhhQZfzqrF1FaS33K809DblXA8tJdQRhnnUfMinSAnyCA IrRy0Mhg7lNJr1VwslAKfpfxB4pcoR2SF61xIc0KnQomn9gwbkUrPNGo2ILq8w7ECJzF tiBuyzaqCCEe7NVk7c7aPozdJHY/62TSV884qVDXTOUyryENh6Zgi8DC2C2ijh7L5M7F uhPGBRPpwIoMjUW/ffolT7Zqkm84d6kPQlxnYmIAk/1oicbimZ131PGP4YvZ2KS8w0QZ RkdS2dmkO/aehAWcM4PFYhD977GpkNd3FnlpU94kPE1loO3d11XOM5izR9GnWs298MVz aPJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; bh=KGs/4HyS9IVS8+vxBeOfRhaPQDLGF77hsoYb7VUPnr4=; b=OLA0pqFOgHqBhiRfVjXXmHOCcXI5FfsseWN5HYgiSYQKbj3gGYkBa3CQuFayLBYmK5 DPeHDEOKIDUVxxdLNiJcXpP/M7zKa9MTUlD8KY4rJR43T/Qs2IIo6hrgLwOES/0bdB4Y uQ4+SXMCYwKwGQBpYppYfks5Z0QUCxMkb0YLLmB/QFv1qSmqATv2CWNdLnk1vKLUeSHC QcjB9ouOG8X4lLvioyavMcneq9EmZkuwidtlsajwVV41ROFrmsGZrX6s+ZeNsyb3/R3K KPYnrxQVwUzJTjvV7y6ksx9E2Z9UldgIqh0+7jR9mPitQ7nVgVsgRKLXoWPbBb9K+wH9 +Izg== X-Gm-Message-State: ALoCoQk64m9kglU2KQ/XX8wXHOxFM8+Ikhw9EKgyOvYcBMcpzk13+34DfIB+vAG8xCO/Golxa4kxyLn4kWlmy4dzDt/XSdZWHg== X-Received: by 10.112.209.2 with SMTP id mi2mr3553824lbc.139.1452890036217; Fri, 15 Jan 2016 12:33:56 -0800 (PST) Received: from vostro.util.wtbts.net ([2001:1bc8:101:f402:21a:9fff:fe0c:4022]) by smtp.gmail.com with ESMTPSA id r200sm1593067lfd.35.2016.01.15.12.33.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Jan 2016 12:33:55 -0800 (PST) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: "linux-input@vger.kernel.org" Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= Subject: [PATCH 2/3] Input: rotary_encoder - fix device tree error handling Date: Fri, 15 Jan 2016 22:33:49 +0200 Message-Id: <1452890030-23316-2-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1452890030-23316-1-git-send-email-timo.teras@iki.fi> References: <1452890030-23316-1-git-send-email-timo.teras@iki.fi> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 of_get_gpio_flags() can fail, so pass through the error code properly. Most important use case is when it returns EPROBE_DEFER so that the probe gets called again later. Signed-off-by: Timo Teräs --- drivers/input/misc/rotary_encoder.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 0f23d32..156f40f 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c @@ -206,7 +206,7 @@ static struct rotary_encoder_platform_data *rotary_encoder_parse_dt(struct devic struct device_node *np = dev->of_node; struct rotary_encoder_platform_data *pdata; enum of_gpio_flags flags; - int error; + int ret; if (!of_id || !np) return NULL; @@ -219,19 +219,25 @@ static struct rotary_encoder_platform_data *rotary_encoder_parse_dt(struct devic of_property_read_u32(np, "rotary-encoder,steps", &pdata->steps); of_property_read_u32(np, "linux,axis", &pdata->axis); - pdata->gpio_a = of_get_gpio_flags(np, 0, &flags); + ret = of_get_gpio_flags(np, 0, &flags); + if (ret < 0) + return ERR_PTR(ret); + pdata->gpio_a = ret; pdata->inverted_a = flags & OF_GPIO_ACTIVE_LOW; - pdata->gpio_b = of_get_gpio_flags(np, 1, &flags); + ret = of_get_gpio_flags(np, 1, &flags); + if (ret < 0) + return ERR_PTR(ret); + pdata->gpio_b = ret; pdata->inverted_b = flags & OF_GPIO_ACTIVE_LOW; pdata->relative_axis = of_property_read_bool(np, "rotary-encoder,relative-axis"); pdata->rollover = of_property_read_bool(np, "rotary-encoder,rollover"); - error = of_property_read_u32(np, "rotary-encoder,steps-per-period", - &pdata->steps_per_period); - if (error) { + ret = of_property_read_u32(np, "rotary-encoder,steps-per-period", + &pdata->steps_per_period); + if (ret) { /* * The 'half-period' property has been deprecated, you must use * 'steps-per-period' and set an appropriate value, but we still