Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2588582rdb; Mon, 4 Dec 2023 01:36:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhFWEkb8GiwjKOYiIRoH7QQsXgtYDCT6wnQT98m09wHFC7el2FL+xdmyqjrHBrsuTG16dc X-Received: by 2002:a05:6a20:7352:b0:18b:94c5:257c with SMTP id v18-20020a056a20735200b0018b94c5257cmr1193997pzc.16.1701682575352; Mon, 04 Dec 2023 01:36:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701682575; cv=none; d=google.com; s=arc-20160816; b=w9y57WU2QlxKDOK5LoEOwt3xa7xjP5sQbKkMFib3lwFQCPGOZS51c61v1HR5fXAJ0Q EthbHr5tHUOJk3pCVLUt5TwafHnQoXl905+2aWw9yXBkcxGZn9/aqsdOTHg2/ITtvWsQ zqblmF53IrtIF6adIt1tbM72FeIzjWWemEjWQkDJEYGOrMwh+Oklotb9lbisHIzuPgkR NLfcKjXp97j+CAdUiWAQfAnRBa7tXBhUs1SSZsvCMOrXm0NtxcYn4OzGBqLZp7FOHaJB kejc1gyJ0AfYnx1mQfTawxR70t6PibEGnDtZmSiF3oOCsRrUpridIaasc+55lUX4uZcZ MGZg== 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=cffjJvUFWsxdgp9qJiLVkij+XoF+TZsz38c1WQZlyho=; fh=fw6biwzn34ngIUS3OuPB+D+TvAzoz1YwnvitHxA+Jyw=; b=ozfGk8Zcrt6PoornjtMC4qon+aiEI8a19amA7cjomTZncsvlqh5vikk9zJP04XmCAa KfDTazAS50Cy88DfTJLEO68g7OkwuPKEhzTWoUJW2XsuC/6bgtKoD7bD8DB/agOa6M6S ukKO+BXl/Z0xS0Xs9lZ5yGOnIXtOCNGW5MpkHfSg2aHuZ/1w5b+guN+B23srhOHSQZGR 9Vr+jHEE9iCyadNJKglUyaHuVgFJ4E23vDax5Y83gjN6yWw+ySwINdz8BDWUngXiSseE x9e50bq408axCIuRpi7wCCBNObh3xXgvOxLaP5HwBwUd0Yio1CUNXF3qoYNXxn4AcVUm MMIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=aCxEbpks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ck1-20020a056a02090100b005c671034477si2809730pgb.539.2023.12.04.01.36.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 01:36:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=aCxEbpks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0E2CA805A792; Mon, 4 Dec 2023 01:36:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234887AbjLDJfb (ORCPT + 99 others); Mon, 4 Dec 2023 04:35:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234853AbjLDJfO (ORCPT ); Mon, 4 Dec 2023 04:35:14 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58149136 for ; Mon, 4 Dec 2023 01:35:20 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c0a11a914so8843485e9.2 for ; Mon, 04 Dec 2023 01:35:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1701682519; x=1702287319; darn=vger.kernel.org; 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=cffjJvUFWsxdgp9qJiLVkij+XoF+TZsz38c1WQZlyho=; b=aCxEbpksu1Qd6S2UOdyExLFlzGpiThUFwFt8nT+HZzKdS94b3g31TRo5NLa9jS5TGv bM/+8gCAJ9Lh9br0BGITvdg5ZLk+2e60EyjjsLBUPbOAAoR0UjhNBOSj+Dp/iazsTsMZ yXOaJbL4DiBoDcA7xpW5GIpn3kH5e4sW5c4ooc+irRENQH3j4DIPBMpFku8RfFoiykcU fdaJLhI32FHlyFXs0HW3yg1EpkK/bteqOQ+N53eznQThmQoAtVcq0wmddw6JK6T2rsua bmmBZdvVxcLRXia58OdJ+bxIKbuzrdrMnajs15Vxf80Y8cFyMhRcgw7NWlV3GxsSWUH4 ckaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701682519; x=1702287319; 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=cffjJvUFWsxdgp9qJiLVkij+XoF+TZsz38c1WQZlyho=; b=boAYYtdYgzLDgq2ffSWrA5AY7PsjFtd4rdCLw1txQ5uodKczxgix+neBfwIUhCcnzj 043Sj17fyQzqqI9gSPT7gXZGTEZXlWAtF1DeKsf/jflYuGDAgs35J2u26V9PUrKNXWZY 3vmAS2gAQvdMc0gBlHA8xqMfjFmmsocWyd5ZaWTSS/cL+Eym5z8pUdu1AljA9J/ygShe GuOve+Tl47jyeaRpKvoq/GC7EV0wMX7j1om6QwA/+t2NIsWG67UqjqcxqYhYnJgLEhzR EdxD9+5XFzKKCyUn6YQBezzldnS3qbPHZI/q78tVku6cOhjRWkLy4HAxBs9FeZyq5XFb t2dA== X-Gm-Message-State: AOJu0YywCu0rU87vFIzBWAXaPszoVLl6PHfgpuMIIgTtGhjqR2K7s+Mf 4tgQHN0Aufsk+sEynTrA/YkTkw== X-Received: by 2002:a05:600c:4708:b0:40b:3d9f:eedf with SMTP id v8-20020a05600c470800b0040b3d9feedfmr2257243wmo.15.1701682518591; Mon, 04 Dec 2023 01:35:18 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:4cb1:229e:8c33:122a]) by smtp.gmail.com with ESMTPSA id fs16-20020a05600c3f9000b0040b48690c49sm14266219wmb.6.2023.12.04.01.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 01:35:17 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Andy Shevchenko Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v3 05/10] pinctrl: abx500: use gpiochip_dup_line_label() Date: Mon, 4 Dec 2023 10:35:04 +0100 Message-Id: <20231204093509.19225-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231204093509.19225-1-brgl@bgdev.pl> References: <20231204093509.19225-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 01:36:13 -0800 (PST) From: Bartosz Golaszewski Use the new gpiochip_dup_line_label() helper to safely retrieve the descriptor label. Signed-off-by: Bartosz Golaszewski --- drivers/pinctrl/nomadik/pinctrl-abx500.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c index d3c32d809bac..80e3ac333136 100644 --- a/drivers/pinctrl/nomadik/pinctrl-abx500.c +++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c @@ -6,7 +6,9 @@ * * Driver allows to use AxB5xx unused pins to be used as GPIO */ + #include +#include #include #include #include @@ -453,12 +455,11 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s, unsigned offset, unsigned gpio) { struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev); - const char *label = gpiochip_is_requested(chip, offset - 1); u8 gpio_offset = offset - 1; int mode = -1; bool is_out; bool pd; - int ret; + int ret = -ENOMEM; const char *modes[] = { [ABX500_DEFAULT] = "default", @@ -474,6 +475,10 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s, [ABX500_GPIO_PULL_UP] = "pull up", }; + char *label __free(kfree) = gpiochip_dup_line_label(chip, offset - 1); + if (IS_ERR(label)) + goto out; + ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, gpio_offset, &is_out); if (ret < 0) -- 2.40.1