From patchwork Thu Aug 14 06:35:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 379831 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 438C414008B for ; Thu, 14 Aug 2014 16:38:35 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHoe9-0002Er-GI; Thu, 14 Aug 2014 06:36:25 +0000 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHoe6-0002DA-PB for linux-mtd@lists.infradead.org; Thu, 14 Aug 2014 06:36:24 +0000 Received: by mail-pa0-f44.google.com with SMTP id eu11so1078549pac.3 for ; Wed, 13 Aug 2014 23:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Sr4WH0FfTe2lIuFoWj+qCqwbBubwKBxYw2FboS1HeB0=; b=vynfVa6fKLFrsv/NpeWcgrMRv0aFZY2t0dmM0PIZX39mLxw1R21oZ2EB75A5eqnboY VdGZTOEqypG7U8AGnixPpuhvofU7qwptMCrPQxM+EEr8JrBWz09k5YlTrkymPIQ4IRDF tH6WaPrLrKS0qRT/nWLooTE3Vq02WPeN1c8gsLX1b9qhQv5WWt76i0PVPbss/90SqBrQ iPre+c6oNmA7Mzs2iuE4mQOajFQyFcqE7AADX5Wz97RHdQ1db3SGiCQJzzVKNfyDSwlz IQylyH87k+u2XzTTWOhS9/hjB8OzbjLv/sKS49uPYh+AeZDb4TbnAN+Cz5JRJB87JqZP djCw== X-Received: by 10.70.96.41 with SMTP id dp9mr213029pdb.156.1407998160977; Wed, 13 Aug 2014 23:36:00 -0700 (PDT) Received: from localhost.localdomain (cpe-98-154-223-43.socal.res.rr.com. [98.154.223.43]) by mx.google.com with ESMTPSA id vu7sm14233440pab.34.2014.08.13.23.35.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Aug 2014 23:36:00 -0700 (PDT) From: Brian Norris To: Subject: [PATCH] mtd: cfi_cmdset_0002: check return code for get_chip() Date: Wed, 13 Aug 2014 23:35:24 -0700 Message-Id: <1407998124-3166-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140813_233622_853796_4F4C3D1B X-CRM114-Status: UNSURE ( 8.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c03:0:0:0:22c listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Cc: Brian Norris , Christian Riesch X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Untested Coverity CID 1230633 Signed-off-by: Brian Norris Cc: Christian Riesch Tested-by: Christian Riesch --- 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 6da141af9cba..c50d8cf0f60d 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,