Re: [PATCH 2/7] drm/meson: fix possible object reference leak

From: Markus Elfring
Date: Thu Apr 04 2019 - 16:06:13 EST


> @@ -720,13 +720,10 @@ static bool meson_hdmi_connector_is_available(struct device *dev)
>
> /* If the endpoint node exists, consider it enabled */
> remote = of_graph_get_remote_port(ep);
> - if (remote) {
> - of_node_put(ep);
> - return true;
> - }
> -
> of_node_put(ep);
> of_node_put(remote);

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/meson/meson_dw_hdmi.c?id=61de49cb596710b918f7a80839f0b6de2017bc32#n712

Can the order of these put calls matter (because of processor caches)?


> + if (remote)
> + return true;
>
> return false;

Would the use of a ternary operator be more succinct here?

+ return remote ? true : false;

Regards,
Markus