From patchwork Tue May 30 08:58:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 768484 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wcSFt6YJ9z9s65 for ; Tue, 30 May 2017 18:58:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="sIjX0+Pr"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751294AbdE3I6y (ORCPT ); Tue, 30 May 2017 04:58:54 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:36706 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751305AbdE3I6u (ORCPT ); Tue, 30 May 2017 04:58:50 -0400 Received: by mail-wm0-f44.google.com with SMTP id 7so82898030wmo.1 for ; Tue, 30 May 2017 01:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TGaXopIcWtXsdR+ZL37ZhAMrrVG9engzx8ur6HfXq1A=; b=sIjX0+PrKc/9M2fOv/xG85t/90TnAc63Pw5WLYM+S7bqZMz7Sc5sQqLxrUABj2BDgo JIBhJK3D0o7cIoD2beZrrlqtgMQzFJC8njqAXe1vlW+f0k9aIXK8MJl/VN1m85261wNv WpGwNJdjdWP95BJnV4JNdv3/2RQE/GrzWr+n8ovYaJY4zgGDuz03iPQaSiPEZxSyAEa4 sHj22ch7cVEBlsT9J6r+DM+X/W8uJV1gUhK5WeDCmtkARvOazaFOqYWitTC9ZrliyYiU uFnG55Jd0E/pgX5njtbLxlQdJWlgzf0oUVnKs4vZLBZCB0Hem/vHox5DhDYZyol6ef4P r+PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TGaXopIcWtXsdR+ZL37ZhAMrrVG9engzx8ur6HfXq1A=; b=PK4G+F717CYNutc6A2CVcgWC7NKYKeKaWJy2cU8mSkVu09Vn+BCa3FenctDAPgi4tT kTKlTXy6jYBTF5GwGe9j97CEODzlYGQfHd/jiYbcRcIn2B7DMpaHpDRod04OxCLL+yBB NbTy/h43ZMqyaaHLW0dc/KMNcUmnKrLdlBlbUCZ19VItMxK5Y1bm66bDkvwAyaAqY9/7 wa3ayDPaJEkgthWyeXJ8W2OX9rqabFc92NJY7rD67FXA5+wvaSGL5lNuJshWD6UwOdFy QssbfRmsi04+UPP2NDS8Od9LCtOkmO2RuYxWsUaZrN4ULV/IifAXFK3TNkknPdRZc9jl FSsg== X-Gm-Message-State: AODbwcD0Lq8Z0Su2XZS7nbCv4xZ0lGd6ioRAOjDVU4u2/90VUdR77Eh+ I+UMRH7XC8kcTN3I X-Received: by 10.223.142.150 with SMTP id q22mr6324181wrb.180.1496134729440; Tue, 30 May 2017 01:58:49 -0700 (PDT) Received: from bgdev-debian.lan (dynamic-194-228-20-36.ipv4.broadband.iol.cz. [194.228.20.36]) by smtp.gmail.com with ESMTPSA id m14sm30863381wmi.2.2017.05.30.01.58.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 May 2017 01:58:48 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Alexandre Courbot , Bamvor Jian Zhang Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 3/7] gpio: mockup: refuse to accept an odd number of GPIO ranges Date: Tue, 30 May 2017 10:58:36 +0200 Message-Id: <1496134720-5363-4-git-send-email-brgl@bgdev.pl> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1496134720-5363-1-git-send-email-brgl@bgdev.pl> References: <1496134720-5363-1-git-send-email-brgl@bgdev.pl> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Currently we ignore the last odd range value, since each chip is described by two values. Be more strict and require the user to pass an even number of ranges. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mockup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index d78e8e0..d95d37a 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -334,7 +334,7 @@ static int gpio_mockup_probe(struct platform_device *pdev) int ret, i, base, ngpio; char *chip_name; - if (gpio_mockup_params_nr < 2) + if (gpio_mockup_params_nr < 2 || (gpio_mockup_params_nr % 2)) return -EINVAL; chips = devm_kzalloc(dev,