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: 833727 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69DD9189B8B for ; Sun, 6 Oct 2024 17:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728236606; cv=none; b=SZTIqiQcqoamYaYSXujZiKFw2HOhOlHz2Yfq5ZslRZoRHM2u+8R3gqGFi+f50822kaOeQvPczOPdl8d1EDKj/2N5nlEiFaZqWDJks1GNu7H+BT59QiE78yHgGU5p+gRG0Zl4FPmXnxBe3oS2hDEKzJz7MOGb4Row7Y/JSMkGMNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728236606; c=relaxed/simple; bh=1mJpiNVP/4OrjcFTAp0TvKU8K5r9YHdExKD16255m4c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y+C/JbCRjIz1FGzgBt9x5wc+G97QWpn1ecMUBuDsiIcQf8zfSaW9Mb3a/nmoDXU2v1fyRFJav6l4arosQHIPyFFMCqVfGCtQUOToKeooehmZyvRDYkl3gIfleTy2JQV1tAlspOpyRxxyPHFV1hjKcpad2JtyPHpcEmPwsB5WNz4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tenstorrent.com; spf=pass smtp.mailfrom=tenstorrent.com; dkim=pass (2048-bit key) header.d=tenstorrent.com header.i=@tenstorrent.com header.b=YUa3z7Ee; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tenstorrent.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tenstorrent.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tenstorrent.com header.i=@tenstorrent.com header.b="YUa3z7Ee" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71df0dbee46so907588b3a.0 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=vger.kernel.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=YUa3z7EeYanq21vQXUg4wpHNmxbWN/+1SfThcZxzQ7DuowGiOyI8PPsjGODnWPr36F 7PTYzYe9youthA8nH3GMl9V4RiZu/dlKOtIQhKAuhH7RHtkqihVILd4g/f+O7y0gkZDR 3E894HBMddwrAY+HgskvOWXbbrF+W4UX2bX6JRCqD4VaazFZJlom8d+mcwS6DBwgZXKP Uioku4k0DCVsqyMFhjUvlzaTOaZfaK6XBCKuiv+n8ybfG6ZBRt2aBi14BLXkpKEUiJfU Li/pD0FNVpxtnkmHAkwjYBaM3IDOp5tM5vCNhEybQ4cfyY9qWJbvNO1GDyzQYx1M5cgm o80Q== 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=iZ1SBVewz5AAViuUmyX4gQjR+tNWQTrVXgchzvTHDHY6ToAa4gez+uFzTCWAXyVBM3 D1Gme2bRVu9/jSpf2NTVzIwBAtoJWujkikomFucITQpMGptn7C7cmRVSpM76ldKFy5Mj hW86w9UvpzDWXqPpHN2f+2l09g0FrzVn7PeaFAkDkCEDkILZL6zxKJT3tv+sV5aHiDWW H8WZQUaQPRnXuCr9cALq0edPUXNf1r6CqUfYF3Svif0pyzqU3pflWfSqV2cTzVja7RXk bVuP0nfC+XG8FgwMJh+N9bf599BycPArUfxkLQGDsazyPGP44N9tkSLASpfvSwBfz/s3 YSqQ== X-Forwarded-Encrypted: i=1; AJvYcCUIZO8BSPRWSSItf+MYsJTy+mXda8tPT69Thq1iXlXJKkqj8ocrNXPJuOMQh5fB6z9Cj29YrF6lELxF@vger.kernel.org X-Gm-Message-State: AOJu0Yz7V0KdsB1I8qmqbD1kmpVN7T5H4ZStORP71aTEqn63mGcmt5ZC ivAHhd+1d6+Qinlfmf6Pq4/q4bw5VBVS2Dj/agNStVZ8S8B2eShKkEUC17MoUew= 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 Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 833726 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A268189F43 for ; Sun, 6 Oct 2024 17:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728236606; cv=none; b=sDrwbwot+lxcFcudSJLXoaoWEaP3/Irj8yfTiayvHpoaOdL5+9uC0lmd12sbHgeDsEAWDhOxW6QO/U+9bmXQ+ROGNpS97ItfGmd2d5GrjKF08EXhKakpqgri8roXHlxkmy9WzzC/NRgaOAe8SkGCKcOTzs0mIi3mDgjypFhLiXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728236606; c=relaxed/simple; bh=F0fzJk3goWwHbOnHvEHn53C9HzZ826eUmoIuPWYk1H8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i4Hx62ulbBbH+vfLs8MulEO1JYBRdEHmB76A3tiKxxgDcT49u84QM6E0yv/6sxTd8QntzGKyrI7G/a7gU22EFrwWWQSX9DyJ16F40STUZb+w6kzzesjldIzQcW1C1w+ZbtjzVFxtntx9YU/bPZ0gOfKaE8C6Ga833xHtu9NkNdM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tenstorrent.com; spf=pass smtp.mailfrom=tenstorrent.com; dkim=pass (2048-bit key) header.d=tenstorrent.com header.i=@tenstorrent.com header.b=HtgOCbPE; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tenstorrent.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tenstorrent.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tenstorrent.com header.i=@tenstorrent.com header.b="HtgOCbPE" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71dfe07489dso407047b3a.3 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=vger.kernel.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=HtgOCbPE1dVQ9uW+WNMQp6KdjucYMffvWeEGtq3GBC/ldFRWrfhaQZdz+G5EtG0omI L93pk8csjQgNsd2gHWDx7CSyF2Xt88odrNPIGKEIcdruGc/ha2gV7hCyWEy6HhY1FTEl 9tmpkOv9Q0yxpttSFjThntYLkbWGr2UjU9EC3SJEDqtikfOqhuUA58/ny6BQRGAQVe0R uLGuWeFjiiHycYoyIlyQ6mDwCKtQiRDChEZmnAoKy0ip5SQsXPbBhCmI871W7/Rb3ZMT fV4szf7YUrUc/3kBPyLhJ098JbQL62gkNsO5svK0Ig7D1UwsPmV6atT8hKsJWHCD9Q4i LqTQ== 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=X5bGtgmNmyeB+66kERrDaacOX5Wd2tH3ijQ6kKhvkJERL7T8g06o3Q6LUqyeQdV4xt 6ekIVH/lYl84GvQ2hCAIq0KAMGRVEFa5qxId0hJNNikIu9CqdI9bCPCjZmkPO1kTquaf 0D3mcJ8o2KbkLWvK3eHFUKOO8IYCDFCeEYZJMMLASQrpIuKnMetk9eG9/90PqZeNs6Mr vkhtj5N1hkWIxB7jzZEnc9aiZFCMZI7Y1ZdT4SaYogrNKnyxnqV4CcGU2/Zab7uecGcS T/CPbjcDHIJN8lQEn254YZMjB9dsjb/uLdY58dmtUpEmlKKn3wOGvtbMhOoMWG6xx+Ku qjaA== X-Forwarded-Encrypted: i=1; AJvYcCXbfyKpXNQsviOBtpZnAoXx8IjmQhhg0PKX/2p1jAd2z9QRy7GIm06S8mrin2nWtksk0JQt6zr1Jvxq@vger.kernel.org X-Gm-Message-State: AOJu0YxqzuhvvefEg+bb3OVvoKd/kIDYf4zHD7ofMOmwo6mLyQUoppWu LL9xbzgXg6HHj9BwQuOU/IvxIAJ5PA5OLzbnmaFzFb0brB/S2ZsCnOss+5gtKSQ= 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 Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 833255 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16426189F5A for ; Sun, 6 Oct 2024 17:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728236607; cv=none; b=TJO29wtzOepqtiCJYcl1421uFiWoGH/7DhL3Z5tz/qxKB618IBp/V5+TsHaa8wkSB3XyjhyIvjIGGVNUzG/8wG87yDQe56GkmF/YgkFfxYcIo5Fprsste6bcW2Tb0wGj/uuTPMu+ZnfLoM3i5VQY49OXdWknMTQCeBVREHw2ZOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728236607; c=relaxed/simple; bh=SgkdYgUrVfbNVcDnV2gz2dPiBb4fP51a6SnhD3AvN14=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fEXdXXBDWvq9ip4Ou8BrR/qr8Uwu73CUHmCfkwNXf78Dds2cCDIByarn0gL6ugM4bQVug8lYIUhR6zUwvr7Crt1lWQ0AUuZlutzp7WuGNXwO3hcXCowopZ/KyXmu6v2FRgpzvmKg6wg6ZgVRZHcWwDsEkwYzz+iLjFfPQrgZF5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tenstorrent.com; spf=pass smtp.mailfrom=tenstorrent.com; dkim=pass (2048-bit key) header.d=tenstorrent.com header.i=@tenstorrent.com header.b=cai/yuOp; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tenstorrent.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tenstorrent.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tenstorrent.com header.i=@tenstorrent.com header.b="cai/yuOp" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-71dfc1124cdso486438b3a.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=1728236605; x=1728841405; darn=vger.kernel.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=cai/yuOpXy2BWZp4hwKeqMb2dCO1oYQJcCfKc1vg3q5DtXezoYNxufhunYsBTjo9j7 SvsxfmakdomJBZ4MZRBp9flnw+NAKi/UG4oOGxfxSPDWjBAJr1tXlHvpCmQLTpkz2Y9X H89GyzZGT4MY4Jw6SJ1AONDzgQkWdhUq7rxETnKxYiRNWdPN38deU5LnJJtFJBhxjk9y A5K7fC2NzzoAFVRmf3g9YpuFkeQ8bOIQX49yd0QjAbqC3wAQvHvLRluQ5Joou/Dfmltc uWNHNYd/9YGyXqLKPNj/EaoqdlQxk2aJpj01E2IyDpvHSQWgYuCW2yLZXCb2p1bPYPtS eWvg== 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=WZOWBkEc2ZcIAPwrOFXKb+rz23CJuohIp9w+JVUxFJhvSIJ/WrSBRtM7xxN0XHYTxF 5TYJBCQnXC7IqvzA4GBNTtlISE2m6RA1Jo2B84Ed4arTzp9f9Q3f1vDyaiXLAreynFgq SUt6qVS4ZvTGIU+Aq4hgqp2oEMs5I6LDaAd8MqveI+6Feo2NZuFtesL/FFpuZPywsbLV P1YyE0EfPEl6T4vtWxSxh1021FI9qUd0k5iB2rsJWblMVbMp1A1gsDlSJklnyt42KhGZ CWgkYfC4ThAytk/8YtBcTSA3S3xoKSEN4j1Pwu+CSMk5UNvFq3YVffEfu4Sd4mfGht01 U4Ug== X-Forwarded-Encrypted: i=1; AJvYcCWRGaEv76BAx1BRPVfi/MfRVRblVLwZqygs0rPK0wA23G5SWAuzHuwN26q0Z1nFdOVn+NquYcM/3y1e@vger.kernel.org X-Gm-Message-State: AOJu0Yw5uOHF1nhM88DwxqGFw6srKBsXuFKMqx0bfFdkmTnD5zEDCwgu Ti0eLkBYoOjQVbcjyZTcSiieW5lBVyCqEAyv9zEPv6eXe1Ag5uuij+mjvSmN7QkMZoTxmnWGNnj I 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 Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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; }