[PATCH 4/7] drm/omap: fix possible object reference leak

Markus Elfring Markus.Elfring at web.de
Thu Apr 4 20:42:32 UTC 2019


> @@ -208,8 +208,10 @@  static int __init omapdss_boot_init(void)
>
>  	dss = of_find_matching_node(NULL, omapdss_of_match);
>
> -	if (dss == NULL || !of_device_is_available(dss))
> +	if (dss == NULL || !of_device_is_available(dss)) {
> +		of_node_put(dss);
>  		return 0;
> +	}

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c?id=61de49cb596710b918f7a80839f0b6de2017bc32#n203

Can it be nicer to add a jump target here?

+	if (!dss || !of_device_is_available(dss))
-		return 0;
+		goto put_node;


>
>  	omapdss_walk_device(dss, true);
>
> @@ -234,6 +236,7 @@  static int __init omapdss_boot_init(void)
>  		kfree(n);
>  	}
>

+put_node:

> +	of_node_put(dss);
>  	return 0;
>  }


Regards,
Markus


More information about the dri-devel mailing list