From patchwork Sun Oct 6 17:43:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 13823814 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 3B1B0CFB424 for ; Sun, 6 Oct 2024 17:43:43 +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=fjQOfYjjnNlVNi 7xD/U3BL6zB+AZuRcZSM0kI5NwCihWKGsXT7hipqSoN+z2AmzaMfw4ivmVyowMqrCXktFEffAk+bT FyTbri45A98Xsn4L6w/pod+JpQgXhiQQGMPiqpRmrQAfLLoBY31sPkd91CgoKIvCaFQl2zTuu4Pmg CAg94I0uNAu/bWOfx05zD8KqeUeX+sMCDY9k9E9z3XTknDsh/3opvaSb4p0mxJ7hbLuqE1+7Qsv6z 9mJ18Q2Uj6m7pfNFy55dWvg8gjVZmceqYzy5cuFC7QBVb+JzbOiodIVqty5njaM/NRHOaEOS+ReQB gLvSlZADbZg9T+ICtj4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxVI0-00000000LmR-2jq9; Sun, 06 Oct 2024 17:43:28 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxVHx-00000000Ll1-0XXn for linux-riscv@lists.infradead.org; Sun, 06 Oct 2024 17:43:26 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-71de9e1f431so1560423b3a.3 for ; Sun, 06 Oct 2024 10:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1728236604; x=1728841404; 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=ClDi+TYV6JVhuY2gfFa7ELXeSKTQyu7pfUjXOpRYytLP0UmnzWE6WkWJfdmna2VelW sDUl9Ja8HTr7VWp151nnFDklZSk7NuYY1PUOd8uZ4iHs4ewIqVWjEQzMiW21XuYvlble 0sSHsxxuzclYt40/6MXlmYMNvaHKooRWSRApGfQzCnrNqNXk3EmQj0fM2Cqesokqs4uQ kmnAwH9S0+AXvARAsAQxv/yUBrjx2vfpjG50g0LdVQjTG/4heYx1W28BOer2ZPC9XmXv pJ/VAkIPiyOkRlw2KjAiOviKAYDxewPHjwHDNTfWixv6d8PMOu4ejSWH1bOKixOqndb9 Ln9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728236604; x=1728841404; 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=miYRP7/hW4jnU4YrtT+s090K1+xy+puAOdZTRBTH80Ygx5q8d2vzc6Yw8GLvkUrFYh V3KM80FRCp5dlt/wLJnOBnlM/vTpkRuSDzCrRgZqcWVorGciMkUGbRKtXHmCxfhKPkmo OraIpnOCo4UbCquHxhrQ+mtBP1L/alegY8dlsj9DUkeFLDrEOJjtRZxD36pphF1nnMak TplyjRIlrg16592CGo7famZ+VyOT82Muxy4SGvMmWTqCOT80NztsBZanFM5X2C2sq46V Q+osHeXCRo1TFBeg41VE2TbNrOYxBu+AStayIwo4XHF0NIixwA64+o8C9Xep4fNMT+ar aV5w== X-Gm-Message-State: AOJu0YxmhLtKKEowjw3J1/kUCEm7dIleyX8RfSfaXDnBy8lw90p/pdCe ajOApowXb85U1RB0CBPUL6lAcR00xfk8vmo4yDz/0ZU4BlnELQYw11wtmmBVx8Y= X-Google-Smtp-Source: AGHT+IEW4o7tvLckDilWYjuXJtcfmQwtg0eJys42bHOEUexDRrnhKPRGjs/rA1lE+MfbcUv1uwJCiQ== X-Received: by 2002:a05:6a21:a34b:b0:1d2:eb91:c0c1 with SMTP id adf61e73a8af0-1d6dfaef79cmr14944850637.42.1728236603796; Sun, 06 Oct 2024 10:43:23 -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 d2e1a72fcca58-71df0d6526bsm2999591b3a.159.2024.10.06.10.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 10:43:23 -0700 (PDT) From: Drew Fustini Date: Sun, 06 Oct 2024 10:43:21 -0700 Subject: [PATCH v2 1/3] pinctrl: th1520: Fix return value for unknown pin error MIME-Version: 1.0 Message-Id: <20241006-th1520-pinctrl-fixes-v2-1-b1822ae3a6d7@tenstorrent.com> References: <20241006-th1520-pinctrl-fixes-v2-0-b1822ae3a6d7@tenstorrent.com> In-Reply-To: <20241006-th1520-pinctrl-fixes-v2-0-b1822ae3a6d7@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 , Dan Carpenter X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241006_104325_204113_3DDB0380 X-CRM114-Status: UNSURE ( 8.46 ) 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 Sun Oct 6 17:43:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 13823812 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 F1BA5CFB442 for ; Sun, 6 Oct 2024 17:43:36 +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=s36gzBRGMjTnCF fhM7N/b+Jxo2eg0ON7J6ygEN3iikXzBj43IwDsl8ug93idr2Wp8V/7z2tO7xZiwDjjx9ggURj8lZF uma+s8dacM9hBvNVDgGQ3A8LJo8S+qvmA1/fSnBm/FftrefwTXObhv3KoSiuRc8oRKaCSuaS0lBwd gAC9NHrq6rPiFARnIW5iesWE0UJYBM4spQedm/W4U+Tn4w776pQriyJp4p89C1JSuV8JoXcfRYwS/ TARKqg24HD4qP7+M+/do1DJexqWJVISFDxAtGKSpHZSfHeawq/QOIMR1DwEuQvVdmgm0T50PiuNoT 0iJ4w2+X2HEzAjJpjgXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxVI1-00000000Lmh-3axn; Sun, 06 Oct 2024 17:43:29 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxVHx-00000000Ll3-2QV0 for linux-riscv@lists.infradead.org; Sun, 06 Oct 2024 17:43:27 +0000 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-7e9fd82f1a5so496640a12.1 for ; Sun, 06 Oct 2024 10:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1728236604; x=1728841404; 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=UKd/NlPr4QgNd0aAinV8Sfvg8zZiEIj2PDtiwtAg42Cgx+p/vhjtCfGxCpRdhe9C11 +GX4HojJ4y0DNmKBsBA7GGxCBF6ohnwKiRxiC7Mdh0Y7Y0cB1tAkxa0XvQFpC5wRDK58 0AiVp7vGz4nVZQP4PFx+NOAmh1KzSxiKVngy8x3cXEkT0xbumJw8zANC4BeMIygnMqvU eR3L2784cmjgbZH/smOLXSVGSJ5XpOZs/tYrhE3r680f9Uddk9stTAo62qEBZOctnnAT weZ2XHJHkZMZBZfG0Ued5kRJJ7o/VzuOv+ORuUmV4Z8HJzrdytyTbTHXDTOpmhFgDiWq U4nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728236604; x=1728841404; 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=eoAdF4b2mXxe/kRF91vwxqXkwTgC4Xl0Ja8XXUhHi8LPem8+UshvXUMiQ7HK8SsFBf zxUNAnKRyu2zFfJbL9Dl+JXBVP/1TINzgS8L6FvgB1agRuodEAFY8QDqNDjBMnTor7gj 2KMe+EKGMyZeU5v/CbDbLt1SuhyPawfnS0buozsvG/mCg4oKIIEdMCQ7hBCbADfNZWLn Iv3O9cMFEmaReV9RbI0b+TRZTgNntFHq2+KYH0Tejg7QwiGBgapWsfxJJ8oN30w5UtBo 1GYcSRfut/VtsyfKttmXG+j6PamdCG02i7xxkkPcATKN2+dcdSS8TS9Y2rwPtIAGrd8E HU1w== X-Gm-Message-State: AOJu0Yz+w0jkoQxhYIfVtspy3dY01PBoTOGjyHkR7LlWEvzith/j3PHT WBBfjTnJBMSijNQTIe8QXIN7d8ouJOsIhbID6sUR58xVSwpC53ja4avNr4NcVyM= X-Google-Smtp-Source: AGHT+IHVc4JR7QyWPEo99nCtTOnKJvnv2SE8G5Rtxbg+iGO4JRlQKbzCRbb7fdIDCqesN12taDtiuQ== X-Received: by 2002:a05:6a20:1a9d:b0:1d6:e61c:23ec with SMTP id adf61e73a8af0-1d6e61c33e0mr7436331637.6.1728236604624; Sun, 06 Oct 2024 10:43:24 -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 d2e1a72fcca58-71df0d6526bsm2999591b3a.159.2024.10.06.10.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 10:43:24 -0700 (PDT) From: Drew Fustini Date: Sun, 06 Oct 2024 10:43:22 -0700 Subject: [PATCH v2 2/3] pinctrl: th1520: Convert thp->mutex to guarded mutex MIME-Version: 1.0 Message-Id: <20241006-th1520-pinctrl-fixes-v2-2-b1822ae3a6d7@tenstorrent.com> References: <20241006-th1520-pinctrl-fixes-v2-0-b1822ae3a6d7@tenstorrent.com> In-Reply-To: <20241006-th1520-pinctrl-fixes-v2-0-b1822ae3a6d7@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-20241006_104325_663482_2152E418 X-CRM114-Status: UNSURE ( 8.98 ) 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 Sun Oct 6 17:43:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 13823813 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 B0C53CFB43F for ; Sun, 6 Oct 2024 17:43:42 +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=fEuU3kYcFoPgLrACXk52YjTg3tGMxDxOmoPO2HnK9cw=; b=EHDszH3+GCzcMW 7OWcm/TReVav80GouemaRdhSyHK9dXbXNXcXATmNH3WkOFjuIXXvQxsgjCpj2nkg4Edmhn9PqVolW hjtPaqNiU8AK/ChdHMKpK0WlIG1Lj0Y/R+EM8VKk7BYgNjuIPuqQ7RCvtK4okZFFdKVPFDlJAX15z sHuu2lVVGxh6kbPHNzQKF9/NHe55kXCAn2JR6IY3rsx7LIvrWG9GsG18IKWFPMO4AFI7BFTfbj65w AugF9xRKH77a7W68b16lu3qIVQU6NiijRPpOxjjkf0DmG1heSnK9v0YZURS/SAN+BzekciR0tbZAd hriLb+YsTjPpbOggi37g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxVI2-00000000Lml-2Ce3; Sun, 06 Oct 2024 17:43:30 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxVHy-00000000Lls-1TKc for linux-riscv@lists.infradead.org; Sun, 06 Oct 2024 17:43:28 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-71df2de4ed4so697682b3a.0 for ; Sun, 06 Oct 2024 10:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1728236605; x=1728841405; 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=djOgLMSN51sHizQfwcHscupKpoOvQDcxpJ2VLwRGCXg=; b=CGzM04aR5UkN1dUE8gi6TjxkEIATkWaqKIqRbe5+KNmEni58ED8NQnsus0VZXaSmK7 V0OAlqL9N9R1igsbz5DAAOXFpHyg18qrLI8DhC+LLBAaxf6mpQrHiglubO+1eYYUCc8b J662WpfNGRNYdAp2j/MU7DtJsRudpnqdu2qNLm47uNdLzNiZSgBT8/ff0HaANWTVkE4/ refbcDGqwJ68KZumpYJFoks+9hpZeTOBr9JrC2Ty40Hw0YPQSUmkcrQzmVXreNV0DBYN NcmCGHRsULPO87NMnmUku1XeuuzT2AJMRgHVKm5u8BEuoCZgxYdzfs20sROAMQGBlE/5 3o0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728236605; x=1728841405; 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=djOgLMSN51sHizQfwcHscupKpoOvQDcxpJ2VLwRGCXg=; b=w/UlpReQKfZIMHmipGH2sOwAaRAzmNHLBVNJw9AsGbLxIp4BzUpGpRwYn7dSxuyR2z 2AnJ3t8Ic2S5BtsE1AfEFulloLdIZ+knbZqOdlAPzD7Qxk7yLg0Oc/ipevxQDtHUXk30 ZI8pJaLzIRhZUFr2I1yKE6R0i09zq6hdV0itPgB0GIoDIclgDx5+n1jIybmdjaE8c3wk YtANX7IwVIUjmx1xn8+L81MejmEtJTjp9z1on6/kjdsABVepuWKUzRqLNi+1eaLEiT5b ETeDi+xUZQ/H9V44hHMXxJ4vfbMx7BZgNAXsszPD1/HWcxU7WSdrUHeMrZOLS3e/RAsR u1hg== X-Gm-Message-State: AOJu0Yy5Ut1BCkan0BOKuoOTvI+gl+eBS6q0Q6MrgusCBkFFxlGEOnsY mn3m/siNzjiKLab5Y6OIC0BMsZuERRrfW+ruNz1iGOhBTzTIeKKvua5ee7SIDjA= X-Google-Smtp-Source: AGHT+IEfzDi9RgOylFPwN1JvO7nrxNbSXiuV8IIZXmhL/38SyLJYVdOoGtu60uzg4Rm52ToOrod0oA== X-Received: by 2002:a05:6a00:b84:b0:71e:190:c131 with SMTP id d2e1a72fcca58-71e0190c1b5mr3066456b3a.13.1728236605481; Sun, 06 Oct 2024 10:43:25 -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 d2e1a72fcca58-71df0d6526bsm2999591b3a.159.2024.10.06.10.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2024 10:43:25 -0700 (PDT) From: Drew Fustini Date: Sun, 06 Oct 2024 10:43:23 -0700 Subject: [PATCH v2 3/3] pinctrl: th1520: Convert dt child node loop to scoped iterator MIME-Version: 1.0 Message-Id: <20241006-th1520-pinctrl-fixes-v2-3-b1822ae3a6d7@tenstorrent.com> References: <20241006-th1520-pinctrl-fixes-v2-0-b1822ae3a6d7@tenstorrent.com> In-Reply-To: <20241006-th1520-pinctrl-fixes-v2-0-b1822ae3a6d7@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-20241006_104326_424857_6C75E126 X-CRM114-Status: GOOD ( 11.01 ) 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 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c index 7ed3f82b9339..286c6b2b0b13 100644 --- a/drivers/pinctrl/pinctrl-th1520.c +++ b/drivers/pinctrl/pinctrl-th1520.c @@ -425,11 +425,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 +444,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 +457,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 +523,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 +534,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; }