Re: [patch] mtd: use correct error codes in debugfs_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The debugfs API is a bit confusing initialy but it's straight
foward to use.  You call:

	dfs_rootdir = debugfs_create_dir(...);

If it returns NULL then you return an error code.  If debugfs is
not enabled then it returns ERR_PTR(-ENODEV) but you don't normally
need to test for it.  After all later when you call:

	debugfs_create_file("wear_report", S_IRUSR,
			    dfs_rootdir, dev, &dfs_fops);

That function is just a no-op because debugfs is disabled.

The problem here is that we test for IS_ERR_OR_NULL() instead of
just if (!dfs_rootdir) which is wrong.  Also if we do hit an error
we return success because the true false bit are reversed.

regards,
dan carpenter
> 
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux