From patchwork Tue Dec 22 14:32:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58904 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3271511lbb; Tue, 22 Dec 2015 06:32:46 -0800 (PST) X-Received: by 10.98.80.138 with SMTP id g10mr36105594pfj.25.1450794766822; Tue, 22 Dec 2015 06:32:46 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si18989947pfj.114.2015.12.22.06.32.46; Tue, 22 Dec 2015 06:32:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751371AbbLVOcq (ORCPT + 4 others); Tue, 22 Dec 2015 09:32:46 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:36459 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbbLVOcp (ORCPT ); Tue, 22 Dec 2015 09:32:45 -0500 Received: by mail-lf0-f41.google.com with SMTP id z124so125547172lfa.3 for ; Tue, 22 Dec 2015 06:32:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=hKRZuyBAs8cNvy6j8W3BRfYBcq0wicu0YRAKyZuZsTY=; b=WDRV4Ox1ummEdsyJgjtnFVN4cDtuaXK64TT5D4YRRPVf2nTGeEQBSDB/f8iqxaTUuY LxrRb+9F1pVVuxJMqUrP0vmJSL9aDdg13r6KV2YctKSdAAWp5KcSe6n+elWYKi6ygXwH P9tzsgrDdLGTb+NHo2+UU+16tS0335bxsO07Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hKRZuyBAs8cNvy6j8W3BRfYBcq0wicu0YRAKyZuZsTY=; b=doa8Zx1eJcW0WnXuJwCGM5cVfhPXPKaU0pV0v0n95Q0sihHqO5agg3jljYeLpn189c 0KOHCRdKPcSY6mYfHurKrh5+nJqVfxsMX7haAzK4Ko8wqRK4YJNVhXnqEgArUYnUlOZQ Ptgjdkx07ONsWeL8mY203k/N0GtwHGDyny8OwJBvJ0STVtPTTTAq3EXRFP7MI7jBjzvf LCmh3xzkIspQixRgj2oycxbLwfpZzptXzsa3Yemi+mV4akfUxkrb3WZsdPfPh1GBkXw6 TERsOfeeS5cksBpTA0YAKiA4bS0bJrUDJzR5GlBbfPu/+B84a1/4G6FOjO1btqvs3npU vCjA== X-Gm-Message-State: ALoCoQkw0CkK+iOi0EXIg7hThsZI8aSkIgOMIYFNSn5HJ+gOUuYu74/+3Pe+lqvE8N3hNyO0HJmYPUKA6PuwUKzUz+o5DP/Eng== X-Received: by 10.25.39.200 with SMTP id n191mr8529374lfn.7.1450794764304; Tue, 22 Dec 2015 06:32:44 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id r199sm3852825lfg.21.2015.12.22.06.32.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:32:43 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Chen-Yu Tsai , Maxime Ripard Cc: Linus Walleij Subject: [PATCH 31/54] pinctrl: sunxi: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:32:41 +0100 Message-Id: <1450794761-24377-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org As we want gpio_chip .get() calls to be able to return negative error codes and propagate to drivers, we need to go over all drivers and make sure their return values are clamped to [0,1]. We do this by using the ret = !!(val) design pattern. Cc: Chen-Yu Tsai Cc: Maxime Ripard Signed-off-by: Linus Walleij --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index a437e4f8628b..c53a2dbdb5cf 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c @@ -469,7 +469,7 @@ static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset) if (set_mux) sunxi_pmx_set(pctl->pctl_dev, offset, SUN4I_FUNC_IRQ); - return val; + return !!val; } static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip,