From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25AB3C6778C for ; Wed, 4 Jul 2018 09:21:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CEDDB21A12 for ; Wed, 4 Jul 2018 09:21:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEDDB21A12 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934503AbeGDJVZ (ORCPT ); Wed, 4 Jul 2018 05:21:25 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:42988 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752814AbeGDJVV (ORCPT ); Wed, 4 Jul 2018 05:21:21 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id F2A9B3C49AC3D; Wed, 4 Jul 2018 17:21:16 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.382.0; Wed, 4 Jul 2018 17:21:09 +0800 From: Wei Yongjun To: Boris Brezillon , Miquel Raynal , Richard Weinberger , "David Woodhouse" , Brian Norris , Marek Vasut , Frieder Schrempf CC: Wei Yongjun , , , Subject: [PATCH -next v3] mtd: spinand: fix missing unlock on error Date: Wed, 4 Jul 2018 09:30:27 +0000 Message-ID: <1530696627-84879-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1530696061-76467-1-git-send-email-weiyongjun1@huawei.com> References: <1530696061-76467-1-git-send-email-weiyongjun1@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the missing unlock before return from function spinand_mtd_(read|write) in the error handling case. Fixes: c898e0526fb6 ("mtd: nand: Add core infrastructure to support SPI NANDs") Signed-off-by: Wei Yongjun --- v2 -> v3: remove blank line v1 -> v2: using break instead of return --- drivers/mtd/nand/spi/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 17d207a..8998dca 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -561,11 +561,11 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from, nanddev_io_for_each_page(nand, from, ops, &iter) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_read_page(spinand, &iter.req, enable_ecc); if (ret < 0 && ret != -EBADMSG) @@ -609,11 +609,11 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, nanddev_io_for_each_page(nand, to, ops, &iter) { ret = spinand_select_target(spinand, iter.req.pos.target); if (ret) - return ret; + break; ret = spinand_ecc_enable(spinand, enable_ecc); if (ret) - return ret; + break; ret = spinand_write_page(spinand, &iter.req); if (ret)