Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2588615rdb; Mon, 4 Dec 2023 01:36:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoMnz0XPkSrYpvgEpjfR5dJsixnkbWWgySGNoTFw33HAXz8YMb40xkXq9be58gfkVn19y/ X-Received: by 2002:a17:902:8495:b0:1d0:6ffd:611c with SMTP id c21-20020a170902849500b001d06ffd611cmr3718435plo.62.1701682577792; Mon, 04 Dec 2023 01:36:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701682577; cv=none; d=google.com; s=arc-20160816; b=rzUYmAP9EocOY3QRrwwL2fpnHdPmhcx35aL0Kc+D4LXnQbVxMzSAztt87Uv3ZcnT8V R64ME/P8UClyXpf9tC5SJPwIrAqePWbphQKYMxL48jpgvncWZUgRw1C6SaXrZS81WWS7 nhVA1GOd2y7nZon78Mh2TZCEsktYTnqzU3g11iHXMG1T8gqJ2gRgSLcFNk+C4tejcqo4 RJqgFaoR+9INob+AmxWL/Kj918dEwl0psZHYZfL81vCxNV3v/oxLEoKLlB+Up/Nevv7J bqz60rXolrYPIAJDsC/tz8Zz+CuAWY63GtZ//cIXDcQj3y/HHLU00tj3dUxGGssSdalj CgzQ== 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=5Sv99NjQCF32QfqStrxQNV++EDXzWOND44xPhDEPFwA=; fh=fw6biwzn34ngIUS3OuPB+D+TvAzoz1YwnvitHxA+Jyw=; b=lh1l/Q+Q7wldclbZ5ftwqBxOJxywfDqLq6cP8m4392eXc/3MrmxwFKkDfjgqFmPY1q 3FrgxMwxSQnsndCwU50Xji8D4wOJkEeina3X+Rk9pb3hNCPl5ytkweNKnW0Lk3rrOewV bsRtfJURU+ujgV9VeU8Gr4kZvUvPoeZ7QCzjIdOISjygHXV6kzgxJwiYQfpB+OfKr1Zw 3ClKlO6Htv+Kndb3gzraj2xc2QCzkRPckocAe/nwM0ggcLdSgJt+nEURuJIjZHoKVG1H Qky8gZyocgDVdWaXOvmijs5i62QIkXSYzjd/BJ2hwB3U7yGv8/j4VRuSI5eNy777CTzj uJLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=i95wUyLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id p5-20020a170902e74500b001bf88e777f9si7941027plf.33.2023.12.04.01.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 01:36:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=i95wUyLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 7AA7D807C554; Mon, 4 Dec 2023 01:35:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234815AbjLDJfT (ORCPT + 99 others); Mon, 4 Dec 2023 04:35:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234818AbjLDJfM (ORCPT ); Mon, 4 Dec 2023 04:35:12 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0CD0124 for ; Mon, 4 Dec 2023 01:35:16 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3333224c7b9so2279244f8f.1 for ; Mon, 04 Dec 2023 01:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1701682515; x=1702287315; 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=5Sv99NjQCF32QfqStrxQNV++EDXzWOND44xPhDEPFwA=; b=i95wUyLNLZz5CTbGL8et8CKZjeP/avgInNMQvRUmE2P7Q5VDwnQvS675+d82tsyeBb PNl1qqSMK/Ev0BJbfhMauF3cOLd+m9dGGIzFca/BImEP0u5tTAeWP1e1XO/was82QZOl jLpSvp/fF0Xup/1p8u9SV2Aa4fiTMPC049o5gwM7+M3NyVpR62gldJCFnXGvXZOy0g6G Ywqlh22KyGpALjvdp0q7VjFR5E1XZI5hqK8vYii/U/j5uMxGphy/kCwhh1I5VCj7P19L b9K3gZWXcm4LzAUmubW38meDcSM0s02wj1XgszPx9BJlHMar4+u4A4nj6vI825qRutkt wOZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701682515; x=1702287315; 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=5Sv99NjQCF32QfqStrxQNV++EDXzWOND44xPhDEPFwA=; b=ZYsoZlHeGSWFzllYunJr5eaqsIAyyv+V367QdH+yiCbLIw2/ZNhAkHa59FjsTVOmbc YFBuiCtGXKANaanuSTVkO+TM+dPxFYIEmEXvhLaNVrT/0W0zWKg6EZRYPBPBdGIjAReI JmRvF9XF0mMuGbICHN4wdijC7EyfI3hdyC4ypoa+E+0moI+wlvYVC+neFZJfh5g+fvMM X/b08HPu0W+wtgmLydeLMvmN78ammx+VR1o42FYWlTOHnHffcfZZqqglp2VowsGCoA53 sHv1XDhuxNCJFqRZ+J4oF4sTcia0JD5iL5A0jOEV5CtRQx+LV8JEg+fZJTCmBHuzYobV RMOg== X-Gm-Message-State: AOJu0YzkX09nxVjlVrcDcuPVMUhMkYYKe2DcoSkiJM5bG3p5xjp797fU ZJNSdkzTFnT4SnoPKNSY9H4CTQ== X-Received: by 2002:a7b:ca49:0:b0:40b:5e21:e276 with SMTP id m9-20020a7bca49000000b0040b5e21e276mr2343776wml.99.1701682514585; Mon, 04 Dec 2023 01:35:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 01:35:13 -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 02/10] gpio: wm831x: use gpiochip_dup_line_label() Date: Mon, 4 Dec 2023 10:35:01 +0100 Message-Id: <20231204093509.19225-3-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=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 04 Dec 2023 01:35:52 -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/gpio/gpio-wm831x.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c index 7eaf8a28638c..f7d5120ff8f1 100644 --- a/drivers/gpio/gpio-wm831x.c +++ b/drivers/gpio/gpio-wm831x.c @@ -8,6 +8,7 @@ * */ +#include #include #include #include @@ -160,18 +161,21 @@ static void wm831x_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) for (i = 0; i < chip->ngpio; i++) { int gpio = i + chip->base; int reg; - const char *label, *pull, *powerdomain; + const char *pull, *powerdomain; /* We report the GPIO even if it's not requested since * we're also reporting things like alternate * functions which apply even when the GPIO is not in * use as a GPIO. */ - label = gpiochip_is_requested(chip, i); - if (!label) - label = "Unrequested"; + char *label __free(kfree) = gpiochip_dup_line_label(chip, i); + if (IS_ERR(label)) { + dev_err(wm831x->dev, "Failed to duplicate label\n"); + continue; + } - seq_printf(s, " gpio-%-3d (%-20.20s) ", gpio, label); + seq_printf(s, " gpio-%-3d (%-20.20s) ", + gpio, label ?: "Unrequested"); reg = wm831x_reg_read(wm831x, WM831X_GPIO1_CONTROL + i); if (reg < 0) { -- 2.40.1