From patchwork Tue Dec 22 14:13:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58880 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp3260183lbb; Tue, 22 Dec 2015 06:13:14 -0800 (PST) X-Received: by 10.66.228.225 with SMTP id sl1mr35890106pac.63.1450793594626; Tue, 22 Dec 2015 06:13:14 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fc7si4639946pab.144.2015.12.22.06.13.14; Tue, 22 Dec 2015 06:13:14 -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 S1754465AbbLVONO (ORCPT + 4 others); Tue, 22 Dec 2015 09:13:14 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:32944 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754124AbbLVONN (ORCPT ); Tue, 22 Dec 2015 09:13:13 -0500 Received: by mail-lf0-f50.google.com with SMTP id p203so131439527lfa.0 for ; Tue, 22 Dec 2015 06:13:12 -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=ZZdFZ7tPI0eg6SZfObuW6SMREuaOC4nV9wbRGsbkM1M=; b=fAMNF6jbM790LfsJWwIEYHmQ6LisyFhQxT6wHS5mYJm1FdQJzhxt4iiIj4BWPtR7B9 0qzpXN8d7G0wBPlKcGcLfbqc+4q+b1b1mW2rfret6EpPoj2S+Bgbosss8XJmdYGbbOMJ fwn4xO0y8ER8vvGwm4TjtCJmFFOVL0bPZ2UsE= 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=ZZdFZ7tPI0eg6SZfObuW6SMREuaOC4nV9wbRGsbkM1M=; b=mB6JLggZfsKx2OmuphNjyGZDXCIXIe9X/6wj5iWBjRj3WDxdjXDJhTBB5vuz7QisKL ZIt17xwcsMuubW+4dEMM3pgiXLbgZptEqjN/Zaq28Gn2KDHquYfTaGLxg9Zt5XRq3wES d0MUGbP12dnzZF0CbhKTmPP9oku45MhrlCO4lVQzxTCrYaLwhn0ca5wTFj91ew4F6iT7 aA/qmlnm5DRuapGx9vFHkFuhEbT522BvvsqOn9fDZKZUs6kciqTm8e3pfb6hQIxRFg52 MHctKTNSc9gIAEV/QT8jrtuhf8TCx7iSabSUMNDw54dsjUkUGFqWDxdsISM5HWxdwckt TrxA== X-Gm-Message-State: ALoCoQnZ4AcyWIZ+96ISq1nrZ6oOc1mZMqAu41WnW6/qSYPMs5y0aPm8EPFZW/OwZnrde5aR5z+HtvHL0H1lMSB2FBYPw5GaZA== X-Received: by 10.25.25.136 with SMTP id 130mr2274580lfz.140.1450793591895; Tue, 22 Dec 2015 06:13:11 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o67sm5876881lfo.33.2015.12.22.06.13.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2015 06:13:11 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Brunner Michael , Guenter Roeck Cc: Linus Walleij Subject: [PATCH 07/54] gpio: kempld: Be sure to clamp return value Date: Tue, 22 Dec 2015 15:13:08 +0100 Message-Id: <1450793588-22180-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: Brunner Michael Cc: Guenter Roeck Signed-off-by: Linus Walleij --- drivers/gpio/gpio-kempld.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/gpio/gpio-kempld.c b/drivers/gpio/gpio-kempld.c index 35dd1e0af364..297f849af725 100644 --- a/drivers/gpio/gpio-kempld.c +++ b/drivers/gpio/gpio-kempld.c @@ -69,7 +69,7 @@ static int kempld_gpio_get(struct gpio_chip *chip, unsigned offset) = container_of(chip, struct kempld_gpio_data, chip); struct kempld_device_data *pld = gpio->pld; - return kempld_gpio_get_bit(pld, KEMPLD_GPIO_LVL_NUM(offset), offset); + return !!kempld_gpio_get_bit(pld, KEMPLD_GPIO_LVL_NUM(offset), offset); } static void kempld_gpio_set(struct gpio_chip *chip, unsigned offset, int value)