From patchwork Mon Apr 12 16:00:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 12198423 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 8D58BC433ED for ; Mon, 12 Apr 2021 15:52:19 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1A4CB6124C for ; Mon, 12 Apr 2021 15:52:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A4CB6124C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=l1wbkuIzpCyUH49sGIP123XZ3JItwu2PbJzYHmDzXG4=; b=iwlS7vFO/sWdnF/uajXa0kI3wj nJk3RDIs3TSlkpIwv5QO4dFVJ3tAXgVb5UASYQ+7cQ/sNnPsrghnq2Lk+nhbyghR9M01xuwKkikSr XAryga1KI3zQKi6Z5Li0u/DBLZZFCQKqJ0iUngOa81vqzp/2JGdqrk9+tO8hrmUY4hAkfkZzckfV7 PZG1GgZNWIZ6QLv1iNkKqsueFruEqGEfWxM/+Mxk6QchVRLQyBvBZXUUGfCCtPViTSZN/nI2nVGVI NQxwlhMaoH0srM4oQFZQ542NDemXgJPvKXVWKGpS1tpX2sYLqibN8fjFVHh5Oy6wY9O12hzlfsLJW k1GQULVw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVypw-007A2A-Mv; Mon, 12 Apr 2021 15:50:52 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVyps-007A1W-Tt for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 15:50:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=V2yZS4vhUtOEmx7XaohezsPuxP0n4VRO9p2jzBqItVk=; b=OX+Xwo5ec0lkUlTrxWndnbpqmA ieW4+++WDmZplzAlYm5XWuOcjqS2ZeaEMZU/uV9Z4EZCNJFgKywbCCZEaSJln7n3xzTVMMHnmkgbt IxvyYz+bYtUPgWOuYAvPyzuNehldXPqSKPijmDTeAG9CYrW/P3EtGaC58aQixszlYVo923uPbdMcR rQu42YjzKsoWT8gVR4WwkiOutKUPzgHZJXHwBxXGiSkfOFleB2UmEyUc5Mq8n4ThHiUslPphFxX6N vlvJUt8tUdEA/z8o7mA12dUE0TGPBlEI27oJ3hMzr+Aoei0xsanwlyX3IbF8q1KCsXkj3R9YVqH2v rMwlf/jw==; Received: from szxga05-in.huawei.com ([45.249.212.191]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVypo-006MVh-Ln for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 15:50:46 +0000 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FJtRJ1r2HzPqLV; Mon, 12 Apr 2021 23:47:40 +0800 (CST) Received: from localhost.localdomain (10.175.102.38) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Mon, 12 Apr 2021 23:50:25 +0800 From: Wei Yongjun To: , Quanyang Wang , Mark Brown , Michal Simek CC: , , , Hulk Robot Subject: [PATCH -next] spi: spi-zynqmp-gqspi: Fix missing unlock on error in zynqmp_qspi_exec_op() Date: Mon, 12 Apr 2021 16:00:25 +0000 Message-ID: <20210412160025.194171-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.102.38] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_085044_902272_B82465C9 X-CRM114-Status: UNSURE ( 9.67 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the missing unlock before return from function zynqmp_qspi_exec_op() in the error handling case. Fixes: a0f65be6e880 ("spi: spi-zynqmp-gqspi: add mutex locking for exec_op") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun --- drivers/spi/spi-zynqmp-gqspi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 9494da9aea40..1670b0aeaa23 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -965,8 +965,10 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem, if (op->cmd.opcode) { tmpbuf = kzalloc(op->cmd.nbytes, GFP_KERNEL | GFP_DMA); - if (!tmpbuf) + if (!tmpbuf) { + mutex_unlock(&xqspi->op_lock); return -ENOMEM; + } tmpbuf[0] = op->cmd.opcode; reinit_completion(&xqspi->data_completion); xqspi->txbuf = tmpbuf;