Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22231118rwd; Fri, 30 Jun 2023 05:42:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4nQErYMLs6EK+FvG3dgjNIm7flfnsqgcgLnqxFP40a6t1I3pK7idTMvgkzJQRycxjrfmdd X-Received: by 2002:a05:6a20:9183:b0:122:cb38:637c with SMTP id v3-20020a056a20918300b00122cb38637cmr2069974pzd.49.1688128928826; Fri, 30 Jun 2023 05:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688128928; cv=none; d=google.com; s=arc-20160816; b=FABJQscPGw7UMfOgluS0p8IB8YhRVTDp3MJAFxQ/q0q9+8PdRuQyl3W9EIas4AQ9vp 2256lIUwAKGXQXqVokOdgAjomYRaKSPAJgcabn+SbWK9TWEJAWJQtO2xcWw9ethl9T/O 9rwRMNfDtUMS3P8PE7eqx0Jdwr4fiFubh8NFJh/ImBEW+m6EfqnBafh6KBW24PHY3gt9 138pd0nV4iTFwglWZYcGguZDYSz2Y8mEEENAJaZu2lxfUdnRGpSomZkfsKRfisG2IHnA ae9/t2m9SS9SjtZfWaTDY9ElJXRKOnzHaqExIeYVQFlEWhPzLcGBMX7Ju25nSsoQVA43 GC0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/M+822NMBcWFhtW8psDduBe6caBnlnfKm7WRYzHuukU=; fh=punYVBkjAbr65jYL2GuvUngXdSB2Eb1DCYORMK3W2vY=; b=Xullu5Bw3UTIwVSblBqj58xxx+PYcCjhgDiuUaQoMeprx8V2M8NCpQDYelcI50nqbx fXN6qJaKxYVYCFM156CeB6f3QydXuxQJca/tB3gH4Vm/jfpv6OP/HYVaQnQi4bwmbgVm GRS4COThSFnQTIkjfJLZUcW9O4MzrCLHfAwGikZvIuVGOE4kRgAqdLckRMuj0FEfnqYm eeVekfBOjkZzug+D4IJ/1H4zd0c8lPoytKQA/5l/u1yAwzz9dV+JMRFySRPkqEP1DzEB BMlLQtD/43m9vPr1XdGBY1J7fnRtK/38vk2Dyf5X0QiKR4Bl95MugylpR6K8bd1okW8a XqzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=rLdjIQN7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cl11-20020a056a0032cb00b0067f4fd59b00si5559154pfb.260.2023.06.30.05.41.56; Fri, 30 Jun 2023 05:42:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=rLdjIQN7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233102AbjF3MG3 (ORCPT + 99 others); Fri, 30 Jun 2023 08:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233016AbjF3MGE (ORCPT ); Fri, 30 Jun 2023 08:06:04 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 687B13C3C; Fri, 30 Jun 2023 05:05:26 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbc656873eso7648435e9.1; Fri, 30 Jun 2023 05:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688126718; x=1690718718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/M+822NMBcWFhtW8psDduBe6caBnlnfKm7WRYzHuukU=; b=rLdjIQN7yit+HWPAMW+jhFcyGvyUsmyIP0VGmjcfLwXF299DfXuhRlt0bNU1yZvjxD c2nZHhKKd32WLaRmNsZfKS6uk+x7WU6HSe2HYj4bmVXbu9+AiEn/C7HhH67IfM6+lJZ2 VCQySiUismfPmy4aq4xIspeNTZ8wm+8lQbCW7Gkz0gn1ygDqUau0L70GiWyqJzyb5lXl 1Ov1CGGt0OinBmPyg6efhLDnkz4Y0YnaRPTi0lIsYhV+0bAOy+5w/D3dTelpWwKQUIO7 Z/0ySqXY943JLZB77FLpcv7kTXRd3Dw0bW5iuF5F1QkYdM+ULE9UOqg1CgzTMyYXyk2x nDbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688126718; x=1690718718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/M+822NMBcWFhtW8psDduBe6caBnlnfKm7WRYzHuukU=; b=KIEZYhWu1jqdWEWoxEMIJuCWz8C6NM3/IQlskqBRsOhSRA0V88OvHq/PbkLqLo8pRj HxlRcQrGtalaVqM/5je5qLc8euuPbMR2Oxvq48e3ANJSH4zpylrSzXExRjZYrwNFGiwe fmcPlZKddm2o+zY+0J3BKQdp+t64xvgVXxSrj/GlfXeJtDS1Qp/e3jawLnZcctaq+GZ/ 19nHaPIo3tgjFxsI5vCclQlr5VRt5co/eZcmEhe1/zTyD3kMpEoKfMZr6Vz5u/YC7f07 /d2OC8k+HQ9JqGsTPOlt1ro9WpEqZVFsrrg+49UJcGaFffwRgt8voZ+0CoUZtQkOr56K uCng== X-Gm-Message-State: AC+VfDy7D/ECGSoTchV74WebjnZLWYki4wJiyPHaMIcIv1GlWBSsarUT Q90qaB+uflzrPDjkA7437R4= X-Received: by 2002:a7b:cd8e:0:b0:3fa:8aed:d57f with SMTP id y14-20020a7bcd8e000000b003fa8aedd57fmr2239809wmj.24.1688126718052; Fri, 30 Jun 2023 05:05:18 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2501:c701:dbbb:7082:18ec:f407]) by smtp.gmail.com with ESMTPSA id k22-20020a05600c0b5600b003fb40f5f553sm11766912wmr.31.2023.06.30.05.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 05:05:17 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Geert Uytterhoeven , Magnus Damm Cc: Rob Herring , Krzysztof Kozlowski , Linus Walleij , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Biju Das , Prabhakar , Lad Prabhakar Subject: [RFC PATCH 2/4] pinctrl: renesas: pinctrl-rzg2l: Add validation of GPIO pin in rzg2l_gpio_request() Date: Fri, 30 Jun 2023 13:04:31 +0100 Message-Id: <20230630120433.49529-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230630120433.49529-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20230630120433.49529-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lad Prabhakar Validate the GPIO pin request in rzg2l_gpio_request() callback using rzg2l_validate_gpio_pin() function. Signed-off-by: Lad Prabhakar --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index a0c2e585e765..2fc1b880db0c 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -780,12 +780,18 @@ static const struct pinconf_ops rzg2l_pinctrl_confops = { static int rzg2l_gpio_request(struct gpio_chip *chip, unsigned int offset) { struct rzg2l_pinctrl *pctrl = gpiochip_get_data(chip); + const struct pinctrl_pin_desc *pin = &pctrl->desc.pins[offset]; + u64 *pin_data = pin->drv_data; u32 port = RZG2L_PIN_ID_TO_PORT(offset); u8 bit = RZG2L_PIN_ID_TO_PIN(offset); unsigned long flags; u8 reg8; int ret; + ret = rzg2l_validate_gpio_pin(pctrl, *pin_data, port, bit); + if (ret) + return ret; + ret = pinctrl_gpio_request(chip->base + offset); if (ret) return ret; -- 2.34.1