mtd: cfi_cmdset_0002: check return code for get_chip()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Aug 15 18:59:01 PDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=5d20bad19d25bb25d9e831dd342c7c714d872b53
Commit:     5d20bad19d25bb25d9e831dd342c7c714d872b53
Parent:     2a500afe1e0e84c7a126df693dbd01353756dcfa
Author:     Brian Norris <computersforpeace at gmail.com>
AuthorDate: Wed Aug 13 23:35:24 2014 -0700
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Aug 15 18:09:00 2014 -0700

    mtd: cfi_cmdset_0002: check return code for get_chip()
    
    Coverity CID 1230633
    
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
    Tested-by: Christian Riesch <christian.riesch at omicron.at>
---
 drivers/mtd/chips/cfi_cmdset_0002.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 5a4bfe3..46c4643 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -1434,6 +1434,10 @@ static int cfi_amdstd_otp_walk(struct mtd_info *mtd, loff_t from, size_t len,
 
 				mutex_lock(&chip->mutex);
 				ret = get_chip(map, chip, base, FL_LOCKING);
+				if (ret) {
+					mutex_unlock(&chip->mutex);
+					return ret;
+				}
 
 				/* Enter lock register command */
 				cfi_send_gen_cmd(0xAA, cfi->addr_unlock1,



More information about the linux-mtd-cvs mailing list