From patchwork Thu Dec 3 15:59:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11949047 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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,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 304A8C433FE for ; Thu, 3 Dec 2020 16:00:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 A8DF8207A5 for ; Thu, 3 Dec 2020 16:00:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8DF8207A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:Mime-Version:Message-Id:Date: 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=GgdKjJCta0ZJQScxY0Z2W760DBZYDBiiUHlqtcRiRUw=; b=xgN9HlMr0S3Zgsbq2GKu3iMMXO uRCz3RkYo7QDTNkTBbL4K2F4e3hmNDdjxOnHu7FjOy3TjzSIYz7rI2GpOTW8WLis+yx8CiSXrlfMA sy2fZ4TJ7G7VEI6ntKfVYiAuHoWPkAKdL8BwtAgsuP/mosfrlIiw9mtF2Hk3nHWjZCBhgW6mlyE83 uPBBwbN5yahms63zNQ9h8tfACMPZphU5fYtAVDSvsoDTrl/rmhO50IZSkyoIweNyLI1nYwgktXl0K CYOk+PgDVqoy/0iQHcNkGRlFd2VVV5Uv7nrbmkjbwhrKDMl5RhTeRGQrePK5jgj6R1kyetPJiC3fs +hfWo8rg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkr16-0003LD-Af; Thu, 03 Dec 2020 15:59:36 +0000 Received: from mail-pj1-x104a.google.com ([2607:f8b0:4864:20::104a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkr12-0003K2-Tm for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2020 15:59:33 +0000 Received: by mail-pj1-x104a.google.com with SMTP id s14so1592212pjk.4 for ; Thu, 03 Dec 2020 07:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=6HgvkaQctZ39JQLge67/z5sx8Qune1Xo2JUMse28/RE=; b=Queth6MrO/59wTlsy5aNmyQhZ/H27qYAc0006X179F/ZV0wEn+c6iXSIH9/dMrIdSQ 9/rM+NV7svjaMTwCmrmxU3vOKzdiddBQHabn+AsIq5IZYyCAErWX7tNqyxzfo5sK97Zd W3NxWUSSec8jqEi3yaDuMl6KF2dX7d2EVatshuS72MuEchpOw1shcJ3edIoxN+GmQROg XwhOr+C/WvKdrm/B+RdPIpPDrRD2ulG2qMBMuDMnOstZdiN4HGk8lG9i7I89x2AFhzEp OhGf/Puz85FPx57sqVH0HxyeR4IOXlzEJDu49OUuZbiaaqpRI5bwTwgzD0jv4uisA8YA 1M5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=6HgvkaQctZ39JQLge67/z5sx8Qune1Xo2JUMse28/RE=; b=Fr2HddRsnTpDOXyhR9RXFIKyrZeP6NiEItNK0WWIvepfORn6Ppfx4NY2c7Q8lIGsAv RAN99u1CGxW9+ThJf+omU/4VFMB46fV2RzGRjdCRik1bXTExKA6smJUDYUNsZdZvX6vc 2ijquJ62W1TO9+yKh1CMm8cyVMOP5PjANPODbbJmf9YYeueowDch2eSxr15S24Nkvor0 RUssHXvn/fQfXsXaWVZ1la5itc6+w71JLXy1vLcrcbGscxfj4cXOJkTBn08YTMDh/+XD LppO2NuXs6+gBBHmY3Q4uTgtDCfVKOUaFR8FBfX36k6pEE7jsdIVLzKCeCJTgIC3G92H pnuQ== X-Gm-Message-State: AOAM532uXXnrgS3CscmDVH9QOU68RIdiCzkuWE5tMrAWBorlJqskIpER lC+UuO17pz9SR2AGP2BCaX7QqsC1IUqT X-Google-Smtp-Source: ABdhPJz+1XJC9kxgToM5jl+h5Yn+AzhAPNrKOpubWS4WAxsCrAuq2jhUyDztT9ag7Zqi5ju0VUh6IiWiEftc X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:b:725a:fff:fe41:c6a5]) (user=tzungbi job=sendgmr) by 2002:a17:90a:17a4:: with SMTP id q33mr707022pja.0.1607011168564; Thu, 03 Dec 2020 07:59:28 -0800 (PST) Date: Thu, 3 Dec 2020 23:59:14 +0800 Message-Id: <20201203155914.3844426-1-tzungbi@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v3] remoteproc/mediatek: unprepare clk if scp_before_load fails From: Tzung-Bi Shih To: ohad@wizery.com, bjorn.andersson@linaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201203_105933_015376_E584FB60 X-CRM114-Status: GOOD ( 12.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mathieu.poirier@linaro.org, linux-remoteproc@vger.kernel.org, tzungbi@google.com, linux-mediatek@lists.infradead.org, pihsun@chromium.org, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fixes the error handling to unprepare clk if scp_before_load fails. Fixes: fd0b6c1ff85a ("remoteproc/mediatek: Add support for mt8192 SCP") Signed-off-by: Tzung-Bi Shih Reviewed-by: Mathieu Poirier --- Changes from v2[2]: - fix the "Fixes" tag format Changes from v1[1]: - add "Fixes" tag - remove an unneeded change [1]: https://patchwork.kernel.org/project/linux-remoteproc/patch/20201202044537.2500497-1-tzungbi@google.com/ [2]: https://patchwork.kernel.org/project/linux-remoteproc/patch/20201203030436.3583198-1-tzungbi@google.com/ drivers/remoteproc/mtk_scp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index 5f42b9ce7185..5e5705fe35a8 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -350,9 +350,10 @@ static int scp_load(struct rproc *rproc, const struct firmware *fw) ret = scp->data->scp_before_load(scp); if (ret < 0) - return ret; + goto leave; ret = scp_elf_load_segments(rproc, fw); +leave: clk_disable_unprepare(scp->clk); return ret;