Bug#773991: flash-kernel: Fails when mtdblock kernel module isn't loaded
On Fri, 2015-01-02 at 11:09 +0100, Uwe Kleine-König wrote:
> Hello Ian,
>
> > Uwe, any chance you could try this please:
> >
> > diff --git a/functions b/functions
> > index d45a4e6..a7ff6de 100644
> > --- a/functions
> > +++ b/functions
> > @@ -41,7 +41,11 @@ error() {
> > mtdblock() {
> > local mtdname="$1"
> >
> > - sed -rn "s,^mtd([^:]*).*\"$mtdname\"\$,/dev/mtdblock\\1,p" "$PROC_MTD"
> > + local dev=`sed -rn "s,^mtd([^:]*).*\"$mtdname\"\$,/dev/mtdblock\\1,p" "$PROC_MTD"`
> > +
> > + modprobe -q mtdblock && udevadm settle --exit-if-exists=$dev || :
> > +
> > + echo $dev
> I would have added the modprobe call only if the device doesn't exist,
> but I guess that's only cosmetic.
modprobe will silently do nothing if the module is already loaded or is
builtin so not checking is fine plus is simpler. There's also a benign
TOCTOU race with checking for the device first (from something else
modprobing in parallel).
> I just installed flash-kernel 3.30 and as expected this one works fine.
Thanks.
> Sorry I didn't come around to test this earlier, I was AFK most of the
> time around Christmas/new year. Thanks for your work on this bug.
No problem.
Ian.
Reply to: