[PATCH] libmtd: fix mtd_dev_present return value on legacy systems

Brian Norris computersforpeace at gmail.com
Mon Sep 15 10:49:49 PDT 2014


On Wed, Sep 10, 2014 at 11:56:40AM -0300, Guido Martínez wrote:
> On legacy systems, if "/proc/mtd" doesn't exist or gives a read error,
> mtd_dev_present returns -1 (since it calls legacy_dev_present), contrary
> to what's specified in the header file.
> 
> This causes checks like
> 
>   if (mtd_dev_present(n)) {
>     ...
>   }
> 
> to give false positives. Fix this by comparing the return value to 1.
> 
> Signed-off-by: Guido Martínez <guido at vanguardiasur.com.ar>

Pushed to mtd-utils.git. Thanks!

Brian



More information about the linux-mtd mailing list