From patchwork Fri Jul 27 01:15:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 143005 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp227262ljj; Thu, 26 Jul 2018 18:15:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpch2WcZKe//DkHdadaPHBi+Eon55Hz7VplXZjNcvW3JXnGzmnrATljs5oCcdq8sn20+8mnW X-Received: by 2002:a65:4cc5:: with SMTP id n5-v6mr3946640pgt.451.1532654145346; Thu, 26 Jul 2018 18:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532654145; cv=none; d=google.com; s=arc-20160816; b=XcUamtyjEO3/0m//L+sR+QTwxLHGQl5TONKkRg21KX9Ty12EVFHQUdE2dIRHRfJXvg y3TIG/bjRtYhoO0KoAQABVZRn6kaAI6vxmhoxklylQqbxNt/dWWsKwkXYlCgMIgYh0iL v8MGhnSXHNPC0HgLMCCXFn2JgTEM6zCEZK0RPXRuc3lkSD6lF6hFUWWDmZLpObR2zXcR xPb5qKnTvU4/HkTKqSozrpszy4ajVP2YBM3sDYL4Krc2tKO7AlMshwojBrADOPlbajjl 571qS2deqlEAANnYhQ6NuEAsmwQ2EIuv4r9psdYgIXVw8dladMKf8HUPlmsQJIAuLzHv zdYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=j72lq73NtZ6WcJqi6LjnMrZkNgEnY48S/HD0ZL4YlKw=; b=uj9nnwL4SubbY46veOajLrIIdVthqLKKXdSv9imN+9NH12d6Iau2oHked7r8lsd7rr qler73hNsSCo9PKusIEMmvihM514StZUg3W7zQRAuK74Zfl4yLW0HnW0UGbehIlmJ5x+ jx9F7tIJWd+7jWZeDti51m4TRzwCGOVEjgzwnnO5llOx9RRTfiX2do7K9iWxWgE+x5OQ MiVK4gg7aZu3Dpdn/YiWJeZvNItZXpz2zwk5qVArGujKGqpp9ZICzIvRpgq7D2atT6qm 5qbZvHC3HVWql9ZJQvxiYseArRb9vhSBzR1fv83UV0ddhRJxb3Rd8UqK6UnGnKo+Rhhj B0qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=LztS+kAL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10-v6si2567728pgf.312.2018.07.26.18.15.45; Thu, 26 Jul 2018 18:15:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=LztS+kAL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732058AbeG0CfE (ORCPT + 31 others); Thu, 26 Jul 2018 22:35:04 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:57248 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731737AbeG0CfE (ORCPT ); Thu, 26 Jul 2018 22:35:04 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w6R1Fexx045202; Thu, 26 Jul 2018 20:15:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1532654140; bh=j72lq73NtZ6WcJqi6LjnMrZkNgEnY48S/HD0ZL4YlKw=; h=From:To:CC:Subject:Date; b=LztS+kALZeyGqivxPImbiSDocsfPDFB6Ym45Y1/uRUWuTqO8Yo4aQ0ItCkJexZ2ua KU3z0E6YU7HO+E/OtwS/gtHBPaOAxU4rz5h4CCCboIowMOU5WfdcmBOKp/EXhOpNyY 2BqDTj/DvlEMfDVkea/3TsjivkhrOZI+Nw5n7k3g= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w6R1Fedd026904; Thu, 26 Jul 2018 20:15:40 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 26 Jul 2018 20:15:39 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Thu, 26 Jul 2018 20:15:39 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w6R1FdQ0000696; Thu, 26 Jul 2018 20:15:39 -0500 Received: from localhost (irmo.dhcp.ti.com [128.247.58.153]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w6R1Fdx08708; Thu, 26 Jul 2018 20:15:39 -0500 (CDT) From: Suman Anna To: Bjorn Andersson CC: Ohad Ben-Cohen , Loic Pallardy , Arnaud Pouliquen , , , Suman Anna Subject: [PATCH] remoteproc: Reset table_ptr in rproc_start() failure paths Date: Thu, 26 Jul 2018 20:15:35 -0500 Message-ID: <20180727011535.21729-1-s-anna@ti.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unwind the modified table_ptr and restore it to the local copy upon any subsequent failures in the rproc_start() function. This keeps the function to remain balanced on failures without the need to balance any modified variables elsewhere. While at this, do some minor cleanup of the extra lines between the failure labels as well. Signed-off-by: Suman Anna --- drivers/remoteproc/remoteproc_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.18.0 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index eadff6ce2f7f..afef2d491c5b 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -953,7 +953,7 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) if (ret) { dev_err(dev, "failed to prepare subdevices for %s: %d\n", rproc->name, ret); - return ret; + goto reset_table_ptr; } /* power up the remote processor */ @@ -979,10 +979,11 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) stop_rproc: rproc->ops->stop(rproc); - unprepare_subdevices: rproc_unprepare_subdevices(rproc); - +reset_table_ptr: + if (loaded_table) + rproc->table_ptr = rproc->cached_table; return ret; }