From patchwork Thu Dec 3 03:04:36 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: 11947631 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 E511FC6369E for ; Thu, 3 Dec 2020 03:06:14 +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 6684F21D91 for ; Thu, 3 Dec 2020 03:06:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6684F21D91 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=wrNcxMlCGzw3JGUYmyqHTUhRvMYNcZ/82z/H65PKxXY=; b=I+tqCO35FnS0ebaiXmrABpUr2v iLovp2HOyUJaqvGqk3ij+CiyvJ1BKcY/eTpHaKQMMGu5qvEaUoxQxMVd5DrtgDBtcmgVTNnixXjOf za0fADzu61sBwknBIChOcLaK3oiJGLnkke1IbL5VvHXK7FGsLUDBv0GGljakMMKpa4Wz5Dhz1v8W6 PKXHGXS4IOa/9uiaJkI5zuPhMVWM/kUt8TC351ntLoJPX/vdqU5zB77K+G9sTBdGvCKVec2px4IqZ i1ABB8gEjU8I9+HcwknC2+K6pr91mPUKSB0nGjBayXwUgAX7S8PMXfbTh1TRHhsi7WQ8a05/25ez3 rMbUnsLA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkevP-0004ao-OO; Thu, 03 Dec 2020 03:04:55 +0000 Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkevN-0004Zs-DI for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2020 03:04:54 +0000 Received: by mail-qv1-xf49.google.com with SMTP id m3so545083qvw.5 for ; Wed, 02 Dec 2020 19:04:50 -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=n1Thr1QG5H70oA7HSV+H9a2yla9+nJFCx4pWGGue+rc=; b=JRy3NfPfy9ofYP9u1wWVP3fc6cRMdScZf4wNMqGwvV1gBZuWnVIIp2rD++NJpZ4/Sb utQwHGmxkLC6g3oNyjqvZhNmLITEzL8FIE9+QJ+KsbeIV6nLKKl/Hpm0PtJc+YTtXLye rlN/RgeYKXW+hBkt8dbox++A+LErAiihLO0GdnO3sA8LLCK6vveLCWuvLvlqZ4DfQLtV 61veTGfVo4uxvCPOcFSHIHSSVB8KLRXOveEisluSDDRrNiL+XOz/RSWS8wpz1YX9KwzH u1CJYeVZ3AkbXJBS1zh6vdHVsVRW9N/fgl2cIcNkcOg5iOOoo+knyvZFY+3GwoAP32/s c5/A== 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=n1Thr1QG5H70oA7HSV+H9a2yla9+nJFCx4pWGGue+rc=; b=JV4vEOFBQZwH9RmTXHBZTz6zQH5q9wCpfg5Dd4QIjB3BYSyVYojnX98IYhk9hYO0Pz 3C48ftlVtEAgZY6tLl1wMUr/1cTQq4JYozCLbD5NondNeYSTC2urEby4PwCOCK4UpXvB PUSedRWEVHKZ/WeK+RXBmu1yK5WSZ29/PZ3UCGRzM2jITsDT6wi/+iwXTjkY+SHmEGVF VkmY5u/zNGhmhrq0SqghKTXOAXEh4Tw4ODQ3YDXO3J+W7/oQ/GvhuXAfLhqMlq1PXbBB t4kcFXR1eZs+aQGDp47mbzShwWje0jurJS2puTQg+X1FGP3k9CDQipC/2mrCKR5mJYjd K2+Q== X-Gm-Message-State: AOAM532Kv9EdXjVP48OrqBj+2g5VU3CFMhGwW37RYPj0EdoClbeCMclc EP4mSKn2pIMWOLpa8dS8/a9bM/omNQlE X-Google-Smtp-Source: ABdhPJy+sHblLew+WFUgX1IsEjUCzi7+3RCW9sClYSBseRZ/jc7YG/WQXsgDxOg9FRePGawd+N67BpTmdy6G X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:b:725a:fff:fe41:c6a5]) (user=tzungbi job=sendgmr) by 2002:a05:6214:18d0:: with SMTP id cy16mr1092968qvb.3.1606964689440; Wed, 02 Dec 2020 19:04:49 -0800 (PST) Date: Thu, 3 Dec 2020 11:04:36 +0800 Message-Id: <20201203030436.3583198-1-tzungbi@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v2] 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-20201202_220453_545793_E236E5E5 X-CRM114-Status: GOOD ( 12.55 ) 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: fd0b6c1ff85a4 ("remoteproc/mediatek: Add support for mt8192 SCP") Signed-off-by: Tzung-Bi Shih --- 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/ 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;