]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/meson: Fix refcount leak in meson_encoder_hdmi_init
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 11 May 2022 05:40:51 +0000 (09:40 +0400)
committerNeil Armstrong <narmstrong@baylibre.com>
Wed, 18 May 2022 07:09:23 +0000 (09:09 +0200)
of_find_device_by_node() takes reference, we should use put_device()
to release it when not need anymore.
Add missing put_device() in error path to avoid refcount
leak.

Fixes: bcf5446630b8 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220511054052.51981-1-linmq006@gmail.com
drivers/gpu/drm/meson/meson_encoder_hdmi.c

index 5e306de6f485382081f6cd22f65c4acecfe001f7..de87f02cd388ed011ac05d7e045b0db53e18ef4e 100644 (file)
@@ -435,8 +435,10 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)
                cec_fill_conn_info_from_drm(&conn_info, meson_encoder_hdmi->connector);
 
                notifier = cec_notifier_conn_register(&pdev->dev, NULL, &conn_info);
-               if (!notifier)
+               if (!notifier) {
+                       put_device(&pdev->dev);
                        return -ENOMEM;
+               }
 
                meson_encoder_hdmi->cec_notifier = notifier;
        }