From patchwork Mon Dec 4 09:35:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 750808 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="aCxEbpks" Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47C3411F for ; Mon, 4 Dec 2023 01:35:20 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40b4746ae3bso37649195e9.0 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=cdRmTTGRaGH5XOYkTlHLjJI/4/MHuRAdGTUUdOBAFPkJvhsO/YSTzoteCVwk4S8u80 hd4fA/JzQk3oS0vNvvfMY75mvrqUsUQizMstunbQf7lMfVM0irdZeAZvwvFHyxjp2oHI 3pPvNYqX+wRBze3oB65FxGZba5fjCTmhmVs5zTdZujHrPYlLvcf2kfxKm4iBa/Env4FU DCuBollfpLy4GaDQrrje3vbKubV5q74WeeqjJzIcOsFWyXrMkRNbgJ0te+Osc1c7EXol cilVniWRcW+dbCGaA5oQ+q/8o+5dRxnydpfgyzcWNKKOlVKe5U0ubGWPNsEzVM9guUHJ R2ZQ== X-Gm-Message-State: AOJu0YzY6pViFPAA/fY0l8Ss1qtTL2pD7j673h6a0GpyOxkln8UPfhiV pqtzvsPPcez+wtFgJh1djagt7w== X-Google-Smtp-Source: AGHT+IG5zgdmvymXaEV/9HDjU94CDsHzttR6WEf8JW7wnFekYp+m3ngvnASxirGcw0oJzT9gwgOS7A== 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> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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)