[PATCH] cramfs: probe(): fix cdev lookup

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Wed Dec 16 08:08:36 EST 2009


On Tue, Dec 15, 2009 at 09:40:10PM +0100, Marc Kleine-Budde wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Peter Korsgaard wrote:
> >>>>>> "Marc" == Marc Kleine-Budde <mkl at pengutronix.de> writes:
> > 
> > Hi,
> > 
> >  >> @@ -431,7 +431,7 @@ static int cramfs_probe(struct device_d *dev)
> >  >> if (strncmp(fsdev->backingstore, "/dev/", 5))
> >  >> return -ENODEV;
> >  >> 
> >  >> -	priv->cdev = cdev_by_name(fsdev->backingstore);
> >  >> +	priv->cdev = cdev_by_name(fsdev->backingstore + 5);
> > 
> >  Marc> IMHO sizeof("/dev/") (and perhaps a comment) make the code more readable.
> > 
> > That would be sizeof("/dev/") - 1 to not count in the trailing 0.  The
> 
> doh! I'm out of brown paper bags.
instead of sizeof("...") - 1, strlen should work.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |




More information about the u-boot-v2 mailing list