diff mbox series

drm/bridge: tc358767: fix missing of_node_put() in for_each_endpoint_of_node()

Message ID 20241013-tc358767-of_node_put-v1-1-97431772c0ff@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/bridge: tc358767: fix missing of_node_put() in for_each_endpoint_of_node() | expand

Commit Message

Javier Carrasco Oct. 13, 2024, 6:11 p.m. UTC
for_each_endpoint_of_node() requires a call to of_node_put() for every
early exit. A new error path was added to the loop without observing
this requirement.

Add the missing call to of_node_put() in the error path.

Fixes: 1fb4dceeedc5 ("drm/bridge: tc358767: Add configurable default preemphasis")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/gpu/drm/bridge/tc358767.c | 1 +
 1 file changed, 1 insertion(+)


---
base-commit: d61a00525464bfc5fe92c6ad713350988e492b88
change-id: 20241013-tc358767-of_node_put-14a3004e9f45

Best regards,

Comments

Marek Vasut Oct. 13, 2024, 8:36 p.m. UTC | #1
On 10/13/24 8:11 PM, Javier Carrasco wrote:
> for_each_endpoint_of_node() requires a call to of_node_put() for every
> early exit. A new error path was added to the loop without observing
> this requirement.
> 
> Add the missing call to of_node_put() in the error path.
> 
> Fixes: 1fb4dceeedc5 ("drm/bridge: tc358767: Add configurable default preemphasis")
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
>   drivers/gpu/drm/bridge/tc358767.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index 159c95b26d33..942fbaa1413a 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -2405,6 +2405,7 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc)
>   			if (tc->pre_emphasis[0] < 0 || tc->pre_emphasis[0] > 2 ||
>   			    tc->pre_emphasis[1] < 0 || tc->pre_emphasis[1] > 2) {
>   				dev_err(dev, "Incorrect Pre-Emphasis setting, use either 0=0dB 1=3.5dB 2=6dB\n");
> +				of_node_put(node);
>   				return -EINVAL;
Right, thanks!

Reviewed-by: Marek Vasut <marex@denx.de>
Neil Armstrong Oct. 21, 2024, 1:08 p.m. UTC | #2
Hi,

On Sun, 13 Oct 2024 20:11:29 +0200, Javier Carrasco wrote:
> for_each_endpoint_of_node() requires a call to of_node_put() for every
> early exit. A new error path was added to the loop without observing
> this requirement.
> 
> Add the missing call to of_node_put() in the error path.
> 
> 
> [...]

Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-fixes)

[1/1] drm/bridge: tc358767: fix missing of_node_put() in for_each_endpoint_of_node()
      https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/5c23878252515b8d2b86839bd4cb7dea7088aacd
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index 159c95b26d33..942fbaa1413a 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -2405,6 +2405,7 @@  static int tc_probe_bridge_endpoint(struct tc_data *tc)
 			if (tc->pre_emphasis[0] < 0 || tc->pre_emphasis[0] > 2 ||
 			    tc->pre_emphasis[1] < 0 || tc->pre_emphasis[1] > 2) {
 				dev_err(dev, "Incorrect Pre-Emphasis setting, use either 0=0dB 1=3.5dB 2=6dB\n");
+				of_node_put(node);
 				return -EINVAL;
 			}
 		}