From patchwork Thu Mar 12 10:09:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 449365 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 B6C8B1400DE for ; Thu, 12 Mar 2015 21:09:28 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753409AbbCLKJ1 (ORCPT ); Thu, 12 Mar 2015 06:09:27 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:49970 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753444AbbCLKJZ (ORCPT ); Thu, 12 Mar 2015 06:09:25 -0400 Received: from ayla.of.borg ([84.193.93.87]) by andre.telenet-ops.be with bizsmtp id 2a9P1q00b1t5w8s01a9Pmn; Thu, 12 Mar 2015 11:09:23 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1YW03O-0005Wk-Uc; Thu, 12 Mar 2015 11:09:23 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1YW03O-0006ve-Vd; Thu, 12 Mar 2015 11:09:22 +0100 From: Geert Uytterhoeven To: Linus Walleij Cc: Laurent Pinchart , linux-sh@vger.kernel.org, linux-gpio@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v3 3/4] pinctrl: sh-pfc: Use reg_width instead of reg as sentinel Date: Thu, 12 Mar 2015 11:09:15 +0100 Message-Id: <1426154956-26583-4-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426154956-26583-1-git-send-email-geert+renesas@glider.be> References: <1426154956-26583-1-git-send-email-geert+renesas@glider.be> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org All other loops over sh_pfc_soc_info.data_regs[] use pinmux_data_reg.regwidth as the sentinel, which is safer as zero is never a valid regwidth value (reg could be zero if we start using it to store an offset). Signed-off-by: Geert Uytterhoeven Acked-by: Laurent Pinchart --- v3: - Add Acked-by, v2: - New. --- drivers/pinctrl/sh-pfc/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c index aa2fc77a1925e839..5d3a35ce09125a45 100644 --- a/drivers/pinctrl/sh-pfc/gpio.c +++ b/drivers/pinctrl/sh-pfc/gpio.c @@ -84,7 +84,7 @@ static void gpio_setup_data_reg(struct sh_pfc_chip *chip, unsigned idx) unsigned int bit; unsigned int i; - for (i = 0, dreg = pfc->info->data_regs; dreg->reg; ++i, ++dreg) { + for (i = 0, dreg = pfc->info->data_regs; dreg->reg_width; ++i, ++dreg) { for (bit = 0; bit < dreg->reg_width; bit++) { if (dreg->enum_ids[bit] == pin->enum_id) { gpio_pin->dreg = i;