Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2588478rdb; Mon, 4 Dec 2023 01:36:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIubDGtdQVUBDjMcqcZ04m1BZYIyUrdNXQ8iDnn2EgITqF3F+Dkrrz4U0hQ6fvNX1LwhuU X-Received: by 2002:a17:90a:7282:b0:286:591b:48fc with SMTP id e2-20020a17090a728200b00286591b48fcmr2900922pjg.27.1701682562237; Mon, 04 Dec 2023 01:36:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701682562; cv=none; d=google.com; s=arc-20160816; b=gKYKxBs/j4GH2KDLsxptJ6gmuDKm2U8OzCWHb1GxIs4HgB2eNmSiRR15muU2XF0rGe YS+83lN5fD+R6jar/SnYEHsra82OgVbJ+gSht7iMrnxbhZhSJHrCw0mbpXD+Wj+IyObQ /XWcefBE3BUeRPzsVzrUDl6naoAqJ6rV11E4H6s1VB4wT1vD/new7HX5ZAH7Bk7YKRG2 5UmId8uxciyNFFr2/rb6kQzrfc7oE0/eyTLYl/VIDQD6v0BVXc8VyAPKLN1H4JySZ2WB eGpl1CSpPmmUoztwYHtf8T3J3IgWNRI2YDNpn1YdDYiY1q0Bg8RcxYL2eH4nLJAmMFxx iZPA== 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=S7P6Y0m2hGBRRFmWFTt/dmCRHf+pQxLzAw7kKW52hRs=; fh=fw6biwzn34ngIUS3OuPB+D+TvAzoz1YwnvitHxA+Jyw=; b=dtCnxMyUctWAmSfErN2+e0rYjaRRpuh0AfwhCWD6IAnI1L7sOYVlEiYr3h1mcm/l1C KG7hDTXLeqNjLroNegZp2oST2NhszS1ajbH/k4+9HYv9+v0C8McfALFQWTLcFt5bU5yC oygrjPmehkhu+7GohAsPFDkDKbE6VT2aZvtWMHm5XBqJhtJrnLFsAHEyzODzsXlxYX9y zlPh3GH5jwL+q/w9pSmmx0jzSzI8GCHy/49hY8YUTIyFjSzG54DySaBPtam8yqv4i7DY j5P1BI2g5ekcxkokc4KioeDzKe4Ox0iMcRkFunWPeISprdRwxkXuxGoxJy0+88acWtIj VQyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=JRRbyB69; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id il15-20020a17090b164f00b0027cdee52324si2338855pjb.74.2023.12.04.01.36.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 01:36:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=JRRbyB69; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 5D583809E739; Mon, 4 Dec 2023 01:35:43 -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 S235284AbjLDJf0 (ORCPT + 99 others); Mon, 4 Dec 2023 04:35:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234827AbjLDJfN (ORCPT ); Mon, 4 Dec 2023 04:35:13 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16B1BE6 for ; Mon, 4 Dec 2023 01:35:19 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40c08af319cso13311695e9.2 for ; Mon, 04 Dec 2023 01:35:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1701682517; x=1702287317; 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=S7P6Y0m2hGBRRFmWFTt/dmCRHf+pQxLzAw7kKW52hRs=; b=JRRbyB69kiCLpu/4ZG4DzhiF/GZvns/kelMSC/ykVyX1XYkXMpRtb7VCDhqMZAKy+0 KJONePiulejgrDDvoe93uT4kd65FXJ0y70pjYxy353zUCKS/DuupHHtehJEqXnu2P7g7 p7Nz5i6aucvfuzR73L3HOgYHOfnVqiSPvWYm05h9hLOFMKAcM5cgB554Mv2AgeFsEM2W L+lHxtGoMTkH33cSqvVc/E7Yc/+WcImUEX/MyugubJ0u1SbkoO8cLbhLynpCK+mSQKqz Rz2QpBAoJ7o77LSAtFPDRKkvcudACDr/CP3OJ29I/7JXatavob0yJLuhkRix8i6GxX1E P2zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701682517; x=1702287317; 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=S7P6Y0m2hGBRRFmWFTt/dmCRHf+pQxLzAw7kKW52hRs=; b=L+f7m82c5HA3PWcZ0bzrwUt0LbHLHxLpRC2kzFpcRZzFWDdkaL01BsStQF0VQiWR6e vJDv4SmownF2F97BPnDg9lMv1A8oe4OWBW++0YqlwfBb6pUWmuBxMQdT+B4bHglNzkbd 21xCOwCveVm0rBlLOdpaBU26pvD4ksMlTMhzwhI3iHWYoMj62F7KGVondx+5DY4CNlm8 2DmyTwnKXCK6743juLB5WWHbJiS5CzHKoygXnNLLVhdB14TDbgeEBtGlh7e9M6udOrjn 9oCvu3lpuswWGeJ/QF7hQsyIDgoPcUQC168jVEcUwrzt5q9d2bT4A5h/gtrBjhnt8TR8 M0Qw== X-Gm-Message-State: AOJu0Yyvy6/McAHvcLEfqqLoo/2sT+KVJzkSW0Qn/nJiGdo6+pQ9Y7E6 h6ut1+feITw5PvarAaSVxVqWvA== X-Received: by 2002:a05:600c:524f:b0:40b:5e21:ec2a with SMTP id fc15-20020a05600c524f00b0040b5e21ec2amr2044570wmb.92.1701682517494; Mon, 04 Dec 2023 01:35:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 01:35:16 -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 04/10] gpio: stmpe: use gpiochip_dup_line_label() Date: Mon, 4 Dec 2023 10:35:03 +0100 Message-Id: <20231204093509.19225-5-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_NONE,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:35:43 -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-stmpe.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 27cc4da53565..6c5ee81d71b3 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -5,6 +5,7 @@ * Author: Rabin Vincent for ST-Ericsson */ +#include #include #include #include @@ -255,7 +256,6 @@ static void stmpe_dbg_show_one(struct seq_file *s, { struct stmpe_gpio *stmpe_gpio = gpiochip_get_data(gc); struct stmpe *stmpe = stmpe_gpio->stmpe; - const char *label = gpiochip_is_requested(gc, offset); bool val = !!stmpe_gpio_get(gc, offset); u8 bank = offset / 8; u8 dir_reg = stmpe->regs[STMPE_IDX_GPDR_LSB + bank]; @@ -263,6 +263,10 @@ static void stmpe_dbg_show_one(struct seq_file *s, int ret; u8 dir; + char *label __free(kfree) = gpiochip_dup_line_label(gc, offset); + if (IS_ERR(label)) + return; + ret = stmpe_reg_read(stmpe, dir_reg); if (ret < 0) return; -- 2.40.1