From nobody Thu Nov 28 01:37:47 2024 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 EC63E158D96 for ; Sat, 5 Oct 2024 19:35:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728156939; cv=none; b=F566MR2/qCZkZr6cEekfyCTGQcxjQunYJJzPXS61QPW/XPYx3MxCpYAFS5OAq5mdEAIFQRClBBSwdwlzk2PX6RgLvepaAKPmu9wyMQbWqqCQ3Dv6VfiCW+eUXRkwARsv2Ka7WNkYr8ClPbP9MJ4uKFThLpFDi6ZCM0EF39lLuEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728156939; c=relaxed/simple; bh=benKogcid3gWGDiiF4qrE6LH9w7SY9gbrzcC5YO+XbA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YlQ59bURePwxv9AUHQjl0XyX9WEDPjPE5oZnGZD5d6Nhyo+l2KekeVB60GAy0P8++FBmllGc1Al67C6j16nDrywng2ZKTjdDLvP6PUls58fD1ycZS5tHbsmGrBXS4ZXZW77aumBD6Av2ACpcPnDyiFnzRQjm1lZyX+aRCcBM+yg= 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=a2A2iU1E; arc=none smtp.client-ip=209.85.214.180 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="a2A2iU1E" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-20b78ee6298so20578145ad.2 for ; Sat, 05 Oct 2024 12:35:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1728156937; x=1728761737; 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=siW7EdgyXTgOQPOyS518eaXhNYDdg121ayiXgQNhC30=; b=a2A2iU1ElvxHU/UALx3b71375MbkwGOjpUJijvwtltIvul6x7lsm9pz5npj2H5hZ3X cfOI6at1RfpqlGfi2dSUTCJZOmgl+l42dyy+3dcyUwyhLZf8jepXxMjgZmrARZTue5HI UK31TP4kjynrk9axd/CCNQ1FtSYb9Oc0yiBJmR7omLhqvOinDF3LCe9O9aBZ2CbbhSgM Jg54sxMpIMBIR0UiVNTqQ2OQ61BkmveJ4JEWL7q/O4yW+zw2K2hKR/LBznltKMFN1RQ1 X7wokQzwyZXVg+dazkfbU3jD5DIezhUUFtGpXdq+TrUxRvfdMUwiamvgW65Ea8XPBQbZ 6vFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728156937; x=1728761737; 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=siW7EdgyXTgOQPOyS518eaXhNYDdg121ayiXgQNhC30=; b=bYjmah+fuindxbDCo+RLmsRXAtMx+WQtC7jI3WeMAvEGWwQ4vk+Mz4Xoz4ABAeFOlH figQtz7nu0WMKoOwzbPyc5ogQoHo5//yTONopn/akooQKr95IxXQIoHF99I/sXV44jtl 89CtZW7ZzhtiXc8f9lnUlt4Zwa7o3FXJJbnRWEDeEhGHzkCdLjEvWRlKSZmyGuz2Dzld vHYxsvcmR/49z4yCxhNanamAFu+ebUI+C9+CK1LM68tFySl7fMz+Tth4hTkX7M4Y5LwH dBJt6XIXqpiZAz+juwOq+NFttydkebUnVzT+h6iNLq30pNX0Q7l3WUYf3t6IQZL9xmKz 10Aw== X-Forwarded-Encrypted: i=1; AJvYcCVAhcXMyB51FGR8vD7KriYZ0scF6FZmxyfTdRVoqFTItOxXsWyH6DghFU+RkeCJrDffvhZ3xyq6G32RvzI=@vger.kernel.org X-Gm-Message-State: AOJu0YzgogicuTriOoBk6DDuaqAEpLPTPm9g1g/BDbbJDEkD7aQwdcrz zp85YM0YRZVgoTa9J8jwyEP/Xtme+0qFzfiB15m/sgzWN44fNt9oCtu8X/LBw40= X-Google-Smtp-Source: AGHT+IHxAvGS4eyy68/Pp+oLN7B2msxCL0H1dN/Ea7Y+bzahoG21QB3NmwpOSm+LgTop+ynMkU/8Zg== X-Received: by 2002:a17:902:ec89:b0:20b:982e:73d6 with SMTP id d9443c01a7336-20bff043851mr90330595ad.49.1728156937357; Sat, 05 Oct 2024 12:35:37 -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 98e67ed59e1d1-2e20ae6dfa4sm2208372a91.2.2024.10.05.12.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 12:35:36 -0700 (PDT) From: Drew Fustini Date: Sat, 05 Oct 2024 12:35:27 -0700 Subject: [PATCH 1/2] pinctrl: th1520: Convert to thp->mutex to guarded mutex Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241005-th1520-pinctrl-fixes-v1-1-5c65dffa0d00@tenstorrent.com> References: <20241005-th1520-pinctrl-fixes-v1-0-5c65dffa0d00@tenstorrent.com> In-Reply-To: <20241005-th1520-pinctrl-fixes-v1-0-5c65dffa0d00@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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1= 520.c index 9331f4462480..d03a0a34220a 100644 --- a/drivers/pinctrl/pinctrl-th1520.c +++ b/drivers/pinctrl/pinctrl-th1520.c @@ -425,7 +425,7 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl= _dev *pctldev, int ret; =20 nmaps =3D 0; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int npins =3D of_property_count_strings(child, "pins"); =20 if (npins <=3D 0) { @@ -444,8 +444,8 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl= _dev *pctldev, return -ENOMEM; =20 nmaps =3D 0; - mutex_lock(&thp->mutex); - for_each_available_child_of_node(np, child) { + guard(mutex)(&thp->mutex); + for_each_available_child_of_node_scoped(np, child) { unsigned int rollback =3D nmaps; enum th1520_muxtype muxtype; struct property *prop; @@ -530,7 +530,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl= _dev *pctldev, =20 *maps =3D map; *num_maps =3D nmaps; - mutex_unlock(&thp->mutex); return 0; =20 free_configs: @@ -538,7 +537,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; } =20 --=20 2.34.1 From nobody Thu Nov 28 01:37:47 2024 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 DDFC015920B for ; Sat, 5 Oct 2024 19:35:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728156940; cv=none; b=CVPXoW1Ick1L05QL8gO03CTvBdhAmNA79TVjfUVVwRhDBY4bFK/yCG6nXgrE0HAf8jagE38928NwkQoUwfvqnoEldHe14GSwvuTECw+9HFVYTq/zLeFMHOmeni2bNFf3lnEDMXKpFqCOACKN4tDR/KuJL1xdZCweY+fIB4M2ljQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728156940; c=relaxed/simple; bh=La/A5ykybuQZr/7rIq9G2hRRwTjZREF5LCrLt2DcFno=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RCUeicYGVeRs9EariFumP6M1hF2mT/rvVCwJQsQuqxtv3Sz6RGV/XcztUT3ifYJZZTJFk1Tpyg/AHPHHvWrINQqIMNh6cI1VNtAbBgBugvoHjO3tk6+W+lHf4Qcd3wEwmVHY74g34sp8oxDpXKJM7ZSxU+xuoa6CzwH9dpOUohQ= 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=W5KV/Kca; arc=none smtp.client-ip=209.85.215.169 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="W5KV/Kca" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-7e6b738acd5so1002535a12.0 for ; Sat, 05 Oct 2024 12:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1728156938; x=1728761738; 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=oB2Efzb4PfNe8Kk04ZtI/HUIlV7fy8A7d3zUOzv2nEY=; b=W5KV/KcaETcrZk0O8hP6vNTjLFBqzCD+/AtcFqeOmmX2l9BeRIEfOuM/OIz8RzSXDA FdS45qmqS5xCVp8tt7HeupkVNcM8/FtkMrPZ9ieISXV0/mpvoTqRy4sxNuRcWXevhLU2 5ljcDO1qj3kywk/V/7vw937YExtos/inAyxt0/Ufj69RtYz9vuUZukedmjDk9mIutg7m TtxD23IALfLmk4f55hi5X4/S/6BAFaZ38lmsOe+F03ZcbIZhYGi7UxrYy8ugkYK+PwNq d0WfrJKabyZ5PUWmvXyyBInK/B5+7InagNYj9+AfCMhDyMderkQWMnRxN/dXw88BhNUo EppQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728156938; x=1728761738; 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=oB2Efzb4PfNe8Kk04ZtI/HUIlV7fy8A7d3zUOzv2nEY=; b=juFc2oRRya6CZ6s8X49Ie/Qyufthit2Ofp4BYKsWSYLI6B9jH3/ONeeIlL37aHRecB 87BHXD7MyUVDKKgCB8ZSGEkQglX/KJ+2FAdxrKOD+3yzb5/WB0PusEiBDQQRODI7sfM+ 1syczV6wxS7GwpgqgkKtuvCUab33TVg+6sOM4dcvpiIVhsyu+IHgf1hTjgKrUgubJKKR 7aSYtcnn8UFOyEEJwQaDjsb51cYHzEJ7+k/kSO0XUJE+rCkTrZw2RDa7QoXAsCq3VCTv lmQ6vdVscaTsa09PQ5Sjl+KxYGvo9LzaaoNTemFm15S5xzjXEoAXxhWWum127wK0abbz 4G5g== X-Forwarded-Encrypted: i=1; AJvYcCUniJwZiCKYo8FcJpGDA9GXgRRmIALC9oyJoszGZ9/AeIFoSI8p1zTkHumANOXj3Px5OAsvI/AwY5gthdM=@vger.kernel.org X-Gm-Message-State: AOJu0YygqE3lb/7F2zYNjWZTPnhmzeUiT2G7grPdqRf5GFjsxkceGNZo 620d1T/5T4y45dgCou/zFpjmcBuQTSkZFjBUb4depegKbsiPdIQ6LpgHsAMaWs0= X-Google-Smtp-Source: AGHT+IEOkp++mkE9wG5kj6OwARC3IfLV+wMXPUcPDx2A5yXrs5mQUofUYyfpuNdJVwdTIyJVMrft6g== X-Received: by 2002:a17:90a:e2d5:b0:2e0:778f:d774 with SMTP id 98e67ed59e1d1-2e1e6213064mr8573006a91.2.1728156938138; Sat, 05 Oct 2024 12:35:38 -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 98e67ed59e1d1-2e20ae6dfa4sm2208372a91.2.2024.10.05.12.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Oct 2024 12:35:37 -0700 (PDT) From: Drew Fustini Date: Sat, 05 Oct 2024 12:35:28 -0700 Subject: [PATCH 2/2] pinctrl: th1520: Fix return value for unknown pin error Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241005-th1520-pinctrl-fixes-v1-2-5c65dffa0d00@tenstorrent.com> References: <20241005-th1520-pinctrl-fixes-v1-0-5c65dffa0d00@tenstorrent.com> In-Reply-To: <20241005-th1520-pinctrl-fixes-v1-0-5c65dffa0d00@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 a return value upon an unknown pin error before jumping to free_configs. 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-th1= 520.c index d03a0a34220a..92834b6718b3 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 =3D rollback; dev_err(thp->pctl->dev, "%pOFn.%pOFn: unknown pin '%s'\n", np, child, pinname); + ret =3D -EINVAL; goto free_configs; } =20 --=20 2.34.1