Wen Yang reported that some CEC drivers incremented the refcount of the HDMI device, but never decremented it, potentially leading to memory leaks. Rather than fixing each driver I decided to create a helper function that finds the HDMI device and handles the refcounting correctly. Two drivers (seco-cec and cros-ec-cec) still required a manual patch. Regards, Hans Changes since v1: - Renamed the helper function to cec_notifier_parse_hdmi_phandle - Uppercased 'hdmi' in the error message ("...find HDMI node...") - Added a comment in the helper clarifying that the returned device pointer is used as a key and so shouldn't take a reference. Hans Verkuil (7): cec-notifier: add cec_notifier_parse_hdmi_phandle helper meson: ao-cec: use new cec_notifier_parse_hdmi_phandle helper s5p_cec: use new cec_notifier_parse_hdmi_phandle helper stih_cec: use new cec_notifier_parse_hdmi_phandle helper tegra_cec: use new cec_notifier_parse_hdmi_phandle helper seco-cec: decrement HDMI device refcount cros-ec-cec: decrement HDMI device refcount drivers/media/cec/cec-notifier.c | 30 +++++++++++++++++++ .../media/platform/cros-ec-cec/cros-ec-cec.c | 1 + drivers/media/platform/meson/ao-cec.c | 16 ++++------ drivers/media/platform/s5p-cec/s5p_cec.c | 16 ++++------ drivers/media/platform/seco-cec/seco-cec.c | 1 + drivers/media/platform/sti/cec/stih-cec.c | 21 +++++-------- drivers/media/platform/tegra-cec/tegra_cec.c | 14 +++------ include/media/cec-notifier.h | 19 +++++++++++- 8 files changed, 71 insertions(+), 47 deletions(-) -- 2.20.1