On Wednesday 09 January 2013, Russell King - ARM Linux wrote:
> d = debugfs_create_dir("pm_debug", NULL);
> if (IS_ERR_OR_NULL(d))
> return PTR_ERR(d);
>
> Well, covered above. NULL is success here.
This one is actually worse, because in case of debugfs_create_dir,
a negative error code is documented to mean "success": The debugfs
functions intentionally return ERR_PTR(-ENODEV) when debugfs is
disabled so that any code checking for NULL pretends it is a valid
pointer, but that code is only allowed to pass this pointer into
other debugfs functions that are also stubbed out and never
dereference it.
Arnd
_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss