mtd: cfi_cmdset_0002: check return code for get_chip()
authorBrian Norris <computersforpeace@gmail.com>
Thu, 14 Aug 2014 06:35:24 +0000 (23:35 -0700)
committerBrian Norris <computersforpeace@gmail.com>
Sat, 16 Aug 2014 01:09:00 +0000 (18:09 -0700)
Coverity CID 1230633

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Christian Riesch <christian.riesch@omicron.at>
drivers/mtd/chips/cfi_cmdset_0002.c

index 5a4bfe33112aba9307bdeac6877a4404b24bc7e7..46c4643b7a0776986890bef600674ec3823d01f0 100644 (file)
@@ -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,