[PATCH 2/2] mtd: nand: Remove BUG() abuse in nand_scan_tail

Boris Brezillon boris.brezillon at free-electrons.com
Mon Apr 4 11:30:54 PDT 2016


On Mon, 4 Apr 2016 12:34:00 -0300
Ezequiel Garcia <ezequiel at vanguardiasur.com.ar> wrote:

> On 4 April 2016 at 12:30, Richard Weinberger <richard at nod.at> wrote:
> > Am 04.04.2016 um 17:20 schrieb Boris Brezillon:
> >> On Sat, 2 Apr 2016 15:55:24 +0200
> >> Boris Brezillon <boris.brezillon at free-electrons.com> wrote:
> >>
> >>> On Fri,  1 Apr 2016 18:29:24 -0300
> >>> Ezequiel Garcia <ezequiel at vanguardiasur.com.ar> wrote:
> >>>
> >>>> There's no reason to BUG() when parameters are being
> >>>> validated. Drivers can get things wrong, and it's much nicer
> >>>> to just throw a noisy warn and fail gracefully, than calling
> >>>> BUG() and throwing the whole system down the drain.
> >>>
> >>> I'm fine with this change as long as all callers are checking
> >>> nand_scan_tail() return value.
> >>
> >> Actually, the s3c2410 driver is not checking nand_scan_tail() return
> >> value. Could you send a v2 addressing that?
> >
> > And maybe add __must_check to nand_scan_tail() such that we catch issues like
> > these.
> >
> 
> In fact, why not adding must_check to all the functions that can fail
> in the kernel?
> 
> That'll help catch even more issues ;-)

I'll take your patch and patch the s3c2410 driver myself. Still think
that keeping the BUG() calls until all callers have been patched to
check nand_scan_tail() return code would be safer, but I don't care
enough to spend more time arguing on this :P.

Thanks,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the linux-mtd mailing list