Messages in this thread | | | From | Arnd Bergmann <> | Subject | Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface | Date | Wed, 9 Jan 2013 11:52:29 +0000 |
| |
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
| |