Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4700550imm; Mon, 30 Jul 2018 21:17:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfVpN2sjvP0ZOiZlLFOgQXg4T9FIjBIgyOPqinFv7VeribOIiaGVE08gGK7RQAOpNV782XF X-Received: by 2002:a63:5204:: with SMTP id g4-v6mr19198679pgb.274.1533010649646; Mon, 30 Jul 2018 21:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533010649; cv=none; d=google.com; s=arc-20160816; b=GTTJoWHVJZNWd8YioqB2J8MpYZyjkO81rBUyAJYEjUskt1kkTcSL8q935GiUAMMZ0B ziyQSHraPrMNRyI6EMbqxe7o27/5QmXGhQupRAXeZ3jER1dAnOTUVeXdfh8GxstJzNkc PjYTvp7yUoWqwF6ZHfze7oMh4c3QhleTfcVBQwomaFyA8CVVIHUu7ViFnBm231ERIl7+ BUXUW4QAWp741GpWzA3h9dROGNqKUBqoWDRWNUGZ8smGr0FQE3wLm9m1vvV85HUd8/u6 f6TmT7FghLDczV52tlsTHW6XVyDp0mQmaVlQVkijTa7+pxLHIoge8VePGMK4SRbE0RoG co/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=MxpVKuEw/hc40ww97UYcgH0BI2KmITs21QmWXUnHBSs=; b=YGT/GVFHX47iwwYvz6mbHzzq0QaWGumrh3lH1uHpJTby+Fffh5ytrtgnUuDIlAz+IQ xaahVhYwyLSw6CbkqrqwkVlV6BeHeTz3GwGMxR2yVUxK5grb7OWvoEPLZRzua+nueBaK POE288yJGq0HaphegYUAMWw8cfvwI30iRF2fjqCyBIZGBg4o7D7CHg9Q23o30PDucNFa Ao5B+oeKQkbtsIezZHl/wzkhzh7QyV3IYwP4t7u4rvrSXP9jm2FVmiJ7RAIt05EgE0Rw H3Z50IaQL6WI0qsdVn5phklMsIIU/iA6FmoIrKKCfIIuPBfpylkVwa246mpR1/MxdBxH a0Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gdJ+PXqp; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k125-v6si12166443pgk.315.2018.07.30.21.17.15; Mon, 30 Jul 2018 21:17:29 -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=@linaro.org header.s=google header.b=gdJ+PXqp; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727306AbeGaFx1 (ORCPT + 99 others); Tue, 31 Jul 2018 01:53:27 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39296 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727188AbeGaFx1 (ORCPT ); Tue, 31 Jul 2018 01:53:27 -0400 Received: by mail-pg1-f195.google.com with SMTP id a11-v6so8390161pgw.6 for ; Mon, 30 Jul 2018 21:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MxpVKuEw/hc40ww97UYcgH0BI2KmITs21QmWXUnHBSs=; b=gdJ+PXqpY6HnRHFogXWwh3FGa7bXQWBLKz3LBZhuo0xu7xEjccbVd1PR8eI9NVJjtW 9JUEtBp+p2Ovq6xIv5jCnIB/8NdwQTTD9ACY9oJNQpX1IGQov7zwJMQqBdV1ONgiI964 zAdP7S2YuClT7qq44J77tSoUK3Z/GpugrqV90= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=MxpVKuEw/hc40ww97UYcgH0BI2KmITs21QmWXUnHBSs=; b=QITYnCEvGrLBxFGkZ0XqFoqpx6EEy5Wzjg9Lx/N1xg4cp9OMNIP3sjx4HQfzWWGQ4w iDSIWrWnLj1zMSV1OodGz256eJEMeeuyMXt/yItJ+xMXn7oQW0Ub3yu+lNX7ObTVgjtv kM+oFJ01E3lDVLjblhZZags5qgPW/+m8IF9zCzNfrVh3pgrFpmjZrW1EaMOdBrs1z14K Hpzhjlgd9JBSHRfXglsPuHpyWTmZ0NelvnRcsO1tfR264VFUvUdqxP/sF4SVadHYOUg1 qbbVXRk48dCtCCAvV1ZL7QsIvwsu9OhdgkygCZAmPPr0jSxrxw+A/0tXwY3pIteliDYZ 88aw== X-Gm-Message-State: AOUpUlH+eXSf2dP54El/KQ5ZP9N+XXMYnUl113ZuQ6ScDDwXxPS3nVVz SJz72Af1B4MQmbnsnICFQUo6rg== X-Received: by 2002:a63:fb07:: with SMTP id o7-v6mr19175027pgh.333.1533010511821; Mon, 30 Jul 2018 21:15:11 -0700 (PDT) Received: from builder (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id o3-v6sm15588299pgv.53.2018.07.30.21.15.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 21:15:11 -0700 (PDT) Date: Mon, 30 Jul 2018 21:15:59 -0700 From: Bjorn Andersson To: Suman Anna Cc: Ohad Ben-Cohen , Loic Pallardy , Arnaud Pouliquen , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] remoteproc: Reset table_ptr in rproc_start() failure paths Message-ID: <20180731041559.GC5090@builder> References: <20180727011535.21729-1-s-anna@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180727011535.21729-1-s-anna@ti.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 26 Jul 18:15 PDT 2018, Suman Anna wrote: > 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. > Good catch. > 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(-) > > 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) Regardless of us having a loaded_table it should have the same value as cached_table when we return - which might be NULL if we don't have a resource table. So I applied this without the conditional, please object if I missed something. Regards, Bjorn > + rproc->table_ptr = rproc->cached_table; > return ret; > } > > -- > 2.18.0 >