From patchwork Wed Oct 9 01:16:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 13827358 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82DC7CF042B for ; Wed, 9 Oct 2024 01:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UgZiQ0Gv1ZjFGDY3dpaeQ8id4HcRuoIhXJQhDPK2jLo=; b=A6g4tHwKejAVG6 CH+MyFLNwURyFsfOoEPBRIyupQpGIFXWrO2G0RqOtRv9Bv7W9xaJYPMgNG2jEfoVRxC4hMYr7IUxT 8gjqRlkZsBbbkT+9oNpfjE2G1sBndO98pRkd/8d+nAkNxfoiMIk6CMaxGqREi61W32DzJpSvlN2HX KCpE0C5TNe8HSBSE9zMKCl+Y9i0qdLBMxLpBsOefV8qVXpOUPZ4x9J8VKLiE1qVq3NF3tjtyATByz d0/Hr3MvOSnhZuifvEzp/qf2yNN+AaYIfUbxoLz3KRS9fA4JvmvxnJdgvNxQXkNg0eeEMIQ5sGFYi ELlOrduwJ0eG0dE5gSCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syLKk-00000007a7a-0dh8; Wed, 09 Oct 2024 01:17:46 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syLKg-00000007a6G-1r6N for linux-riscv@lists.infradead.org; Wed, 09 Oct 2024 01:17:44 +0000 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-7c1324be8easo267819a12.1 for ; Tue, 08 Oct 2024 18:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1728436662; x=1729041462; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=J2dcGg6sikxvnM8Tn6Zg71r8Ca2eyP6yTGUfifpMwTY=; b=I/4vOC5OnUSKQO4WtD8HvLpSJ130KIFjXgTciAhHBqEsDqM+7XB8F4tSaAAgbCU8E4 buFZ1Td5AKrA6zV6Rr4Ro5AfjFoV4g8DZAcu9Cejx7K8Dv2s6iklyAvZKyWeeuczg3S6 YZE5hF0P09iM2FqEoKgqE9c64n2XiBXomCwT8rKyOnasAN+zBj8ciQ18o8z8OuSnQhGy 6yQYdP+IFEr0uUE/KBAUJjbaEShktlYei2VdeLfDJ889T01y8dz0jpVZeF7ySbchMtfZ OM2q+QEDWgT3IusLf1ZY9oM+KHwuO3HLmYgUf1w5gBYD886N/Jr7x6qOahr8bZdwks/q Iywg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728436662; x=1729041462; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J2dcGg6sikxvnM8Tn6Zg71r8Ca2eyP6yTGUfifpMwTY=; b=D9cCvuflMRhh5rAPDTockP+NzIcwnuhAQdO5CYZ11kUTezQy595JGB3pCh97eVKRJf tCg4KpIretpXW33/d8qNl80TyaBpLQlFTZn2Gdnt5yPCiSZueaVMhHuUfPmFQEqpS90i QwhOvy9Jl2jbdiVkQ90ZTbUhAgNkneVg4FzQnisv5mURwGDZ3QU0+U4+SWibIRiDxqZp Zd/DSFOUvm8m8Edznj7y8HGi098BLJ7VbtcP+3tnpDPSiT/zyKsSyaZ24D3aQI7yepqy p0FDUxsJRwcTRuyzzpqXTSSU9IMYhz6AIcMCiUmwaKn/WHr9Q6vpOUqBSiQwysQY5WZ2 G0ww== X-Gm-Message-State: AOJu0Yy7+IUGeSzKN6t3HW/UoDQH7NDEwQ3J7wQ5jxzVYua+iDvRna0l l4v1LhWol9yiump9vXD+MHjlXIy4h5xpWgsZOiHCCTn0xhExTyyiO3N2c34mWq4= X-Google-Smtp-Source: AGHT+IG9ZtD9Zd3q75GN23Imw0rYHgFKjP1aIT3fz+CqmO5yL/j7FoVtSH5hft4DRnXSIhe/CGKLbg== X-Received: by 2002:a17:90b:503:b0:2d8:7a63:f9c8 with SMTP id 98e67ed59e1d1-2e27df3a73cmr8151836a91.14.1728436661766; Tue, 08 Oct 2024 18:17:41 -0700 (PDT) Received: from [127.0.1.1] (71-34-69-82.ptld.qwest.net. [71.34.69.82]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cbbc2sm61076365ad.78.2024.10.08.18.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 18:17:41 -0700 (PDT) From: Drew Fustini Date: Tue, 08 Oct 2024 18:16:46 -0700 Subject: [PATCH v3 1/3] pinctrl: th1520: Fix return value for unknown pin error MIME-Version: 1.0 Message-Id: <20241008-th1520-pinctrl-fixes-v3-1-5b60db446a49@tenstorrent.com> References: <20241008-th1520-pinctrl-fixes-v3-0-5b60db446a49@tenstorrent.com> In-Reply-To: <20241008-th1520-pinctrl-fixes-v3-0-5b60db446a49@tenstorrent.com> To: Drew Fustini , Guo Ren , Fu Wei , Linus Walleij Cc: linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Carpenter , Drew Fustini X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_181742_507927_FB832CC8 X-CRM114-Status: UNSURE ( 8.86 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Fix th1520_pinctrl_dt_node_to_map() to set the return value before jumping to free_configs when an unknown pin error occurs. Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202410022336.xyWlV0Tf-lkp@intel.com/ Signed-off-by: Drew Fustini --- drivers/pinctrl/pinctrl-th1520.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c index 9331f4462480..265a75a78d5a 100644 --- a/drivers/pinctrl/pinctrl-th1520.c +++ b/drivers/pinctrl/pinctrl-th1520.c @@ -499,6 +499,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, nmaps = rollback; dev_err(thp->pctl->dev, "%pOFn.%pOFn: unknown pin '%s'\n", np, child, pinname); + ret = -EINVAL; goto free_configs; } From patchwork Wed Oct 9 01:16:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 13827356 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C31DCF042D for ; Wed, 9 Oct 2024 01:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MJdJfUQYL5DvdI47D2097qNS/SU6791FEl6qFQG7B6s=; b=klzw9KzgxAov1p jF1iQ1lc9YqqBDqUVG6+mafe9hCLtQJ/R2PaAyOZUfs1qw7OUBANRqt7x/M3yXIDpb49g7W2bN9zV gtFPmU34O19CaN/+CRzN6FwmouWtWE2b/6xyzaqJqmWRCqFy0Sf0RGBVy2NGsoHL9dgqUA4TG0t7z LL4dhX6/E/JwIOTzZK8yGCiWnxcLKU3YJNvfg0H+nyuSm9jMMAijkNO+Q7AAT90aj8pmJ16KoM4IH PNjUmDhFxVqVG4tEDj0R+OnvVBN7VWvQociH3hKZC6U5qscXL8iBYiCwk78P38qMGfnll2iZR1dbb GLEZOw7qQ+vlqWQU729Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syLKm-00000007a7k-1ksQ; Wed, 09 Oct 2024 01:17:48 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syLKh-00000007a6k-1bHz for linux-riscv@lists.infradead.org; Wed, 09 Oct 2024 01:17:45 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-20b9b35c7c3so65883635ad.3 for ; Tue, 08 Oct 2024 18:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1728436662; x=1729041462; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=A0aqH8Nz3YTxyf3WOUwJPMSHP7Sz01anRaWLkW9KhzE=; b=DaIljaEfaRp54++xltV9s/BPobFn2ED0hDJ3fAKsWuVXgAyJan3EmWS3zloeZh4cED yynmYDqnNmD2UxMKMr5UOQxdMxOedAazBvkxMdX3fPkaRifR0b3wk5jpTWUVGXf7FKLg R2Axrj051Xg9jgSHwN3JV2xhMmFhEMupksLwTtkj7yXVXJVT8VdEN7nQvV+/+9JGh2I1 TARqEPPjrVjo/vx73ycgTXcfZYb8Zu4pHtYMz3ZQPRhwFmWBMsKmRGkXNBAih6FA6Wdt B66Ueli1pahb1vBrTWwm3C8+9Dh4L7F78IH5YbVDYOuDLCHY/5IudU9gRHSJhokQt8dR BpEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728436662; x=1729041462; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A0aqH8Nz3YTxyf3WOUwJPMSHP7Sz01anRaWLkW9KhzE=; b=QdiGPHZn+omwomkEonHlXdSFhFDeHdIewiKabi8Y5j0QCIE3A3GvyiKV1VS9RITmsR bo6eRMbHSE04y99NFNeHneJ8WJ/+WIbrJrBhpyBa2r3qmvurfi7clFNWkOiAVbPDBN1R 17YQcQeLSREp/6vgP7fQVI9z+K+C+VSxl8DVzWVN38ONmYWuO9dsL5+d3ur79/reCBjO OVNhhpVgWKLGJRBIs580vFxQ0wEv9BSbeBeJdWD/MVyKt1OREZemsmABTrGJHWKV9N/i CPlW2w+E2TCFAwFscL4lmlbQf2DLsS0QLXslmEGoBad/Jv+VEc46lCaCI+CqX82ho4On ggGw== X-Gm-Message-State: AOJu0Yx6JqzB3dZIfWCEkvux4GxTZR+dlt7a86sRafxWsFERKUWs32Gy DHI9XCwJCZh4vhNhmht62NlZ4lfeX8nh/9ccMi0N3HxUtRgrBVqbt2v2VPS3Q28= X-Google-Smtp-Source: AGHT+IGI9taZWLdFpMIE4dgnATWsHC+Qt+VhRQuoR+YZVLfax+9lGozJReoLif1bhqH7Lg+Rw73W4g== X-Received: by 2002:a17:903:1107:b0:205:6a9b:7e3e with SMTP id d9443c01a7336-20c639172b2mr13200455ad.56.1728436662596; Tue, 08 Oct 2024 18:17:42 -0700 (PDT) Received: from [127.0.1.1] (71-34-69-82.ptld.qwest.net. [71.34.69.82]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cbbc2sm61076365ad.78.2024.10.08.18.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 18:17:42 -0700 (PDT) From: Drew Fustini Date: Tue, 08 Oct 2024 18:16:47 -0700 Subject: [PATCH v3 2/3] pinctrl: th1520: Convert thp->mutex to guarded mutex MIME-Version: 1.0 Message-Id: <20241008-th1520-pinctrl-fixes-v3-2-5b60db446a49@tenstorrent.com> References: <20241008-th1520-pinctrl-fixes-v3-0-5b60db446a49@tenstorrent.com> In-Reply-To: <20241008-th1520-pinctrl-fixes-v3-0-5b60db446a49@tenstorrent.com> To: Drew Fustini , Guo Ren , Fu Wei , Linus Walleij Cc: linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Drew Fustini X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_181743_425994_4FC6DD3D X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Convert th1520_pinctrl_dt_node_to_map() to use guarded mutex for thp->mutex. Suggested-by: Linus Walleij Signed-off-by: Drew Fustini --- drivers/pinctrl/pinctrl-th1520.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c index 265a75a78d5a..7ed3f82b9339 100644 --- a/drivers/pinctrl/pinctrl-th1520.c +++ b/drivers/pinctrl/pinctrl-th1520.c @@ -444,7 +444,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, return -ENOMEM; nmaps = 0; - mutex_lock(&thp->mutex); + guard(mutex)(&thp->mutex); for_each_available_child_of_node(np, child) { unsigned int rollback = nmaps; enum th1520_muxtype muxtype; @@ -531,7 +531,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, *maps = map; *num_maps = nmaps; - mutex_unlock(&thp->mutex); return 0; free_configs: @@ -539,7 +538,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, put_child: of_node_put(child); th1520_pinctrl_dt_free_map(pctldev, map, nmaps); - mutex_unlock(&thp->mutex); return ret; } From patchwork Wed Oct 9 01:16:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 13827357 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0C56CCF042D for ; Wed, 9 Oct 2024 01:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XRPfca7e4WSODhMHGlG/Gz2yK1SLssaPmx4nabiUmh0=; b=B2qgTIQn93ZWf+ 4MELtjQJzNWQYL3Jv2KhSt+07dHHqlm1XnsKaQOswSkWdfG6U1hN7Afb6cMqkAlL/Gj9TV7TRg69N 6zL6Ed6N/YfMaxCk04JiFCwtuhNXATa845PILLsYjWRvybOZFyqkd+rejNUK6oF8Zl++7K1rfWeAZ o9F3ov0aQlPj408S2cQskh5IYaKvV/2UyIf+m/4KaavZL4n42escHw58RI1yNxvZGi+k2FIVXAYeX fnveuai9UE9vHXMoDD8bqjULUc5QCse4jzRIe8ZZlsK2oihLhKA8nA0hmTMYWMbrSJpjbcECUCw3z RlYu0h2cuNpyoR9i1JdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syLKm-00000007a7o-4BZA; Wed, 09 Oct 2024 01:17:49 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syLKh-00000007a6w-3Xi0 for linux-riscv@lists.infradead.org; Wed, 09 Oct 2024 01:17:45 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20c6f492d2dso3155ad.0 for ; Tue, 08 Oct 2024 18:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1728436663; x=1729041463; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6rcvxYGMoOTRMXFV/E9b+WvC4bJSrWDz1gUOsF/dMGQ=; b=aeT3DC20v6dM8PFMuxOb2Zm4TsfVTG152pMdWlQl8O+MrVPWGGNxRcKEEzRTfhn+kO wNL0BLS+ZRQz3yzWivNjrfHlRwBvlB/EMJtUsaRZNItXbiobqaZBFFzOSz5tJ+TF6SvH VLEYqepKXA9XXzgBoSDLfWpNKHAT5PiYkEeVeyjmI1s8ELnxNRYKbQUD5NUUgPiUdiH/ Hk+01rEb1788KEL6ZOo708Y5WKuByrEeqVTRttrfvUgnp1fSFLGV/5H/M1ZnKgD9P0L1 SxIm/AZpkDDZdp98QEhUf1ClVCMqKNJMrhCx2Q1Via+nafvz/lKPqmolcjP7lniAGVmE RO6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728436663; x=1729041463; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6rcvxYGMoOTRMXFV/E9b+WvC4bJSrWDz1gUOsF/dMGQ=; b=dbGRXGcxWi+pW3wEWvWLvjLa+g+Dr5eOD09VrXkeib+rdB/p6UzlaYosraOx4dPMBa icSOZENlAwV0HJnNWCoZgvMxjWMXJ46CZ4jxpOsD7bAYxXbc2UGRqO6CZIe9oprmockP WMIyyIhsukJdTo7frK4ObihadcE5pg/UWb3k5A8jp6qJePOGVAg40IfJ2fESFeL1zZNz DAHSvaFvweU8bRY+kqQjnxi3tH0nuaYS376hJ/Razjx8p5A6qc3UJRHKkLbmmO3aIEKe zZ96SeqJoc/9TMW2OihV+reO1wkIriY4VslhvTXocPbmKXlr60l9VMm6rFJdZK8sVuJm xsaA== X-Gm-Message-State: AOJu0Yw+/nKNkZD3WyjqKZ/G8oE5G2mpDv4MDTARUqwknzeo/UKi+ljL sqBR+OXVeP2HhuMvSqmZebF2t8ys57Hi6ZjDjQF1j/kQ+YQUDzFUblSMyPIYTFY= X-Google-Smtp-Source: AGHT+IEtnc4cCnA2h/Ncwk1hbYGngsttFCPHK379AweSgZoFPZhde5eOvn3TJ4RE9RdqiHPP0gLTfg== X-Received: by 2002:a17:903:1ce:b0:20b:bac2:88f6 with SMTP id d9443c01a7336-20c639155bemr10883575ad.52.1728436663352; Tue, 08 Oct 2024 18:17:43 -0700 (PDT) Received: from [127.0.1.1] (71-34-69-82.ptld.qwest.net. [71.34.69.82]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c138cbbc2sm61076365ad.78.2024.10.08.18.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 18:17:43 -0700 (PDT) From: Drew Fustini Date: Tue, 08 Oct 2024 18:16:48 -0700 Subject: [PATCH v3 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator MIME-Version: 1.0 Message-Id: <20241008-th1520-pinctrl-fixes-v3-3-5b60db446a49@tenstorrent.com> References: <20241008-th1520-pinctrl-fixes-v3-0-5b60db446a49@tenstorrent.com> In-Reply-To: <20241008-th1520-pinctrl-fixes-v3-0-5b60db446a49@tenstorrent.com> To: Drew Fustini , Guo Ren , Fu Wei , Linus Walleij Cc: linux-riscv@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Drew Fustini X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_181743_919600_0D46F709 X-CRM114-Status: GOOD ( 12.50 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Convert th1520_pinctrl_dt_node_to_map() to use a scoped iterator with for_each_available_child_of_node_scoped(). As a result, there is no need to call of_node_put() anymore. The put_child label has been renamed to free_map which is now a more accurate description. Suggested-by: Linus Walleij Signed-off-by: Drew Fustini --- drivers/pinctrl/pinctrl-th1520.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c index 7ed3f82b9339..c8d2ee6defa7 100644 --- a/drivers/pinctrl/pinctrl-th1520.c +++ b/drivers/pinctrl/pinctrl-th1520.c @@ -417,7 +417,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps) { struct th1520_pinctrl *thp = pinctrl_dev_get_drvdata(pctldev); - struct device_node *child; struct pinctrl_map *map; unsigned long *configs; unsigned int nconfigs; @@ -425,11 +424,10 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, int ret; nmaps = 0; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int npins = of_property_count_strings(child, "pins"); if (npins <= 0) { - of_node_put(child); dev_err(thp->pctl->dev, "no pins selected for %pOFn.%pOFn\n", np, child); return -EINVAL; @@ -445,7 +443,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, nmaps = 0; guard(mutex)(&thp->mutex); - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { unsigned int rollback = nmaps; enum th1520_muxtype muxtype; struct property *prop; @@ -458,7 +456,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, if (ret) { dev_err(thp->pctl->dev, "%pOFn.%pOFn: error parsing pin config\n", np, child); - goto put_child; + goto free_map; } if (!of_property_read_string(child, "function", &funcname)) { @@ -524,7 +522,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, npins, (void *)muxtype); if (ret < 0) { dev_err(thp->pctl->dev, "error adding function %s\n", funcname); - goto put_child; + goto free_map; } } } @@ -535,8 +533,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, free_configs: kfree(configs); -put_child: - of_node_put(child); +free_map: th1520_pinctrl_dt_free_map(pctldev, map, nmaps); return ret; }