From nobody Wed Dec 17 00:14:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10242C4167B for ; Thu, 30 Nov 2023 13:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345847AbjK3Nq7 (ORCPT ); Thu, 30 Nov 2023 08:46:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345722AbjK3Nqh (ORCPT ); Thu, 30 Nov 2023 08:46:37 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEA4A10F1 for ; Thu, 30 Nov 2023 05:46:43 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3331974c2d2so684020f8f.2 for ; Thu, 30 Nov 2023 05:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1701352002; x=1701956802; 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=gdSOQtaof93nM5ia61UhuHXlJsyRqcru/G05JG7W8V1FssY7r+DAfHzJne1PEcTXsF YM5G9ExjsMk8Rr5qeYZ13DnVH3LBZCQMj91lpzi1sq1n066WUmZfO8ebjceDWiYMUv63 lR+I6OhQSHuJ7HdTb24IX7LNdfcigyIVh0OtdsIfxfxVerKJuoblT1VITrUSZAyDf3n8 S9l6zab1Q+hY+sewGCicanmYoVopw2XSSY026wmft/15dYC9N6tFojxW75jjA6olC7I8 tkKVCiKU5496/SECyJMIPJAZc/ae9xT5PaCCWzEqo4elcsHb04oLQPIm7dmojCrOQrKQ Y0hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701352002; x=1701956802; 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=YIfhfUEUJ8NIoHM5RyIAoQS7O5093KTytYoDiwe0qPku0K+KAKSQfbEf6iuMWAiSOg GywWYoyaIKtbNDhiZp6oGZBY1ACOUSTyFR5uOdHdIyqkSiiHXMM2/a2KZ4+kYcdCo5Ch 41FrGd/ZFCLlDgqyOHINhrNuHgOyXP1l8V2/2/Zm9RyFm2+32zlV5q1ZD9Nj4FfPDtGX g8mqBp/WDkhn8DIwhGNFIMzD9fS57F+X3gC9wEGwPQBMJWgVFSAIC72xEW3HMG27Xpf0 TaVPOiDQAIs+ND2WI/gf7qcx10NeOaZ3rh5hsqluE9/rwpqYQC67nmcdFwPlxJEHpGW9 SJtA== X-Gm-Message-State: AOJu0YyXJlqyYKKegpt7oNEZ6T8p74m92Jw2VygibLjrVJMkdjy+cY6G n2XLZdJ5VXKCTzAIJD+ZHOG6XA== X-Google-Smtp-Source: AGHT+IFqmZA1KQhwkSPcUaNoBMtUmaEHugbvUiR1Onas5XzwXX7zZR0pNya8Ie3NAxw5LM70WUUmrA== X-Received: by 2002:a05:6000:36c:b0:333:18b9:27a6 with SMTP id f12-20020a056000036c00b0033318b927a6mr3490982wrf.30.1701352002295; Thu, 30 Nov 2023 05:46:42 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ae84:904:6602:ec1e]) by smtp.gmail.com with ESMTPSA id n18-20020adffe12000000b0032d2489a399sm1574824wrr.49.2023.11.30.05.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 05:46:40 -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 v2 05/10] pinctrl: abx500: use gpiochip_dup_line_label() Date: Thu, 30 Nov 2023 14:46:25 +0100 Message-Id: <20231130134630.18198-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231130134630.18198-1-brgl@bgdev.pl> References: <20231130134630.18198-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/nom= adik/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 =3D pinctrl_dev_get_drvdata(pctldev); - const char *label =3D gpiochip_is_requested(chip, offset - 1); u8 gpio_offset =3D offset - 1; int mode =3D -1; bool is_out; bool pd; - int ret; + int ret =3D -ENOMEM; =20 const char *modes[] =3D { [ABX500_DEFAULT] =3D "default", @@ -474,6 +475,10 @@ static void abx500_gpio_dbg_show_one(struct seq_file *= s, [ABX500_GPIO_PULL_UP] =3D "pull up", }; =20 + char *label __free(kfree) =3D gpiochip_dup_line_label(chip, offset - 1); + if (IS_ERR(label)) + goto out; + ret =3D abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, gpio_offset, &is_out); if (ret < 0) --=20 2.40.1