[PATCH -mm] UBI: one less BUG usage
Randy Dunlap
randy.dunlap at oracle.com
Thu Jun 28 01:13:34 EDT 2007
Artem Bityutskiy wrote:
> On Tue, 26 Jun 2007, Randy Dunlap wrote:
>
>> From: Randy Dunlap <randy.dunlap at oracle.com>
>>
>> Eliminate one BUG() usage. The callers of major_to_device() already
>> handle and report errors. This is just another error to return.
>
> Why is this just an error? It must never happen unles there is a bug in
> the code. Or is there a campaign against BUG() calls?
>
> Artem.
There's always a campaign against unneeded BUG() calls.
However, if you say this one is needed, then so be it.
However(2), ubi_cdev_ioctl() calls major_to_device() and allows it
to return an error [although major_to_device() currently cannot
return such an error]:
ubi = major_to_device(imajor(inode));
if (IS_ERR(ubi))
return PTR_ERR(ubi);
so part of cdev.c allows and handles error returns from major_to_device().
All my patch does is allow and handle error returns from major_to_device()
in vol_cdev_open(). vol_cdev_open() already handles errors by returning
the error to its caller.
--
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
More information about the linux-mtd
mailing list