From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XTaPn-0001Gz-2k for linux-mtd@lists.infradead.org; Mon, 15 Sep 2014 17:50:18 +0000 Received: by mail-pa0-f47.google.com with SMTP id ey11so6923380pad.6 for ; Mon, 15 Sep 2014 10:49:53 -0700 (PDT) Date: Mon, 15 Sep 2014 10:49:49 -0700 From: Brian Norris To: Guido =?iso-8859-1?Q?Mart=EDnez?= Subject: Re: [PATCH] libmtd: fix mtd_dev_present return value on legacy systems Message-ID: <20140915174949.GC14832@ld-irv-0074> References: <1410361000-4821-1-git-send-email-guido@vanguardiasur.com.ar> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1410361000-4821-1-git-send-email-guido@vanguardiasur.com.ar> Cc: linux-mtd@lists.infradead.org, Ezequiel =?iso-8859-1?Q?Garc=EDa?= , Artem Bityutskiy List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Pushed to mtd-utils.git. Thanks! Brian