Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp105303lqh; Mon, 6 May 2024 12:43:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWaCftdvWJz1MwBXZAw3RNR4HuIlZPoEbibq7e8qmAiAczz+l63wU551gTikMP5MAXWPLNDEzubNz6Wb03wpngogQBkq1akVt/Ph+AAZQ== X-Google-Smtp-Source: AGHT+IG9b8IonahblkX3DDWBZhW9qc7kEhLoCDeI4bePs8LXllf9WLienF8yRzNhgWy/IY0HpHWJ X-Received: by 2002:a17:902:f541:b0:1e8:c962:4f6e with SMTP id h1-20020a170902f54100b001e8c9624f6emr13574833plf.20.1715024628137; Mon, 06 May 2024 12:43:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715024628; cv=pass; d=google.com; s=arc-20160816; b=bOvzKQ4rE5/hVMU+XnXWmLlVWHO8Wi8FT0mvyAywpHmBlgtha8M91I0BEjZzrFh1UT oWPx9RqefYngdabRcZMsospDPi8UAk+Q5CcGRASASNEYkE9ZbY9++0yc51OZuuDUU77o t1HOt9UDF9EN8wkfidLUt+tZL906Ak60ZLmLiivDqTJPKiErLE4hlpFiMLS3lGblxyFG xWczoXhDFp2VncuR+zA9w3/qIhwMk4Z9J9yxfr+yaida3IPjA/puNAdhnozLOU6WbY97 +pmk4bU143HgbFbhGkmL34KHMBWxgB3B/MBwY4k1Pf6VKYpE5AbhjMuyGG6GgZlQ0AzH JUHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HfyTe+aA68nIYMVD5N9eoPdgr6eemqU/CSX3fB6JqgI=; fh=jQzSnLnoxxNZevzQWaGaGwX+vL9XpNoFh7Vap1nGP10=; b=PvsBAjH+r4e98Bxm2pp+2u+5xdaeRZ9H70canm85Dis4mJsiinhD90M286cOVLSRqb gkm8oEvwLWNpt4vz1GCULsQJBafJCj0bnFiejNakB3JvygdoiNJqb7FjRQND+XbsRw1h 8Dbj2MnhK2m9sYMTkAfyqoaZprsHu9Xj0wnHrkX0Bi3z/H9wzsFA5NFnqO9OUNwczhfZ I9zAuRpaV4MNRCXJbUQD1ksRgtFkX1jHsbQWrwI5nDV0BAp5RyKcf07+9qIcFQNgfQOb dMHPiC3ROrKUCEBZNaBnHkcV+9eF3KOgppFHxAqoEdJ2HYkLtm7UNnvyh9zmAv1qLVdy csFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s8/zrvH2"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-170354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f5-20020a170902684500b001e433763b5fsi8605558pln.590.2024.05.06.12.43.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 12:43:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s8/zrvH2"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-170354-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EBC28B21987 for ; Mon, 6 May 2024 19:43:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B460915ADA5; Mon, 6 May 2024 19:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="s8/zrvH2" Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DAEA15749D for ; Mon, 6 May 2024 19:43:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715024616; cv=none; b=V78PikNhkexhdYlxAQUMDibTApAu+UvPzBGQdwezO7DRPD/2hyZBSc+CU7T8JIKXauRHbn4+NWqsqktgpdbMAmrZQ9b0KDFCwubZYxXdy0EIYcWRYNRTrEk4iMuHJneN1UpI7VkUPi78ToFFqiOZYsHe+dCDn23eyxlTkEjwUQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715024616; c=relaxed/simple; bh=DKq1/S1mvND3bjPrxatyn7VET9OItUwcH7q3NBufJKw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JdSTn8DXbX5hdjuFNovsX/h4Z8sH2nohJV92tygJ96i/QSRMpKnDLYfbaSda7j+Qn87+ek1C88hqOocDjsR9P0nuU/iTNRqr8kimiCOTNh7VgpPpB7tBmLTsyQGQvXkG3lonID9xd2I9vz17Vuuct+4ruX8Vzyy2iWKW9k78gCY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=s8/zrvH2; arc=none smtp.client-ip=209.85.216.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2b3c711dfd3so1832458a91.2 for ; Mon, 06 May 2024 12:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715024615; x=1715629415; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HfyTe+aA68nIYMVD5N9eoPdgr6eemqU/CSX3fB6JqgI=; b=s8/zrvH2PP02FyIYUm630fpQIr9AuuQb5IXm7WAjLE48zxIUHC8KQKZDK/z+rN8op3 DQno0AK92LsNAU8WkmlbkI1KH2/p6mPP1bCod2kBvvXKgIgpj00vfdJufhZcytPaiSoe PWRsmrVdRDCacYvREfGSiKaQBTXDdG6/bctIdvVMxksvSZLwRG1z+kfcRlJmbhpRzLpH lSk6M3ILILmcYacZSojev5M7qUqmatQ9+PKpFP7PAA9mUAxDWunBFiGN9k0p1SaBxKsc MgjQ+/AZBIdapT+Olj+l/E9sIPKY/e4nJAtxq1fxs4WZpt9Kh+0Sf3fx5mw/9mhMZ2ut tnpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715024615; x=1715629415; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HfyTe+aA68nIYMVD5N9eoPdgr6eemqU/CSX3fB6JqgI=; b=v+zCC8HnFpbGU+FTb9jIOwR3JmGnaIgETV0n0WsT4Wvcv1GLV5WwWJ4qdWWxRNxqDn YoUGJq4XgzAqtPKw5tJ3IRKOlCGhjzAXkwVg+x+wNYFKu5K/vwuhnyefzMEnxXgE4D87 XVPI7SirSW6zUuwlf1hfPKbX/J5mfXCbAl/O4H0j1IMFBaR9kzTIyV/5gjR3lKi4bTKv OLc9wlu2dWxY9m0Uo8QdNBdEJbGUNCKGUloARK24muAv1bn5VDYk4IU08Fu+4n/tH5ce ays4GrcZUI5ym+S1JCTKRrx2Z0KZBPUtAJaL6FTI/CbSgRmCfASVQqP24V5N4/xvvCuC zYQw== X-Forwarded-Encrypted: i=1; AJvYcCX41WFcpEVzD9TCZwWwfXouf1QTvRvKPr0hxBD+xMJrIFL39hO7sfG2Vc/gyf0DmvmGsiPCuce8w7u2p4J09eJrypnsmcvnTgvVn8o1 X-Gm-Message-State: AOJu0Yy65ujdvSmLJIsy316rdJ+j0l+GrsooI2l2k+h3/KorCDsEblm0 C9tRy9y5b/VDDk/6HhuB5W/hCGf4fIBPjTtD3ChpjxOgdla2hhJibDzOVzLS8Cg= X-Received: by 2002:a17:90a:68ce:b0:2a5:badb:30ea with SMTP id q14-20020a17090a68ce00b002a5badb30eamr9053231pjj.36.1715024614703; Mon, 06 May 2024 12:43:34 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:d0a8:32b:6e71:43af]) by smtp.gmail.com with ESMTPSA id st12-20020a17090b1fcc00b002a5d62a7e75sm10393094pjb.52.2024.05.06.12.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 12:43:34 -0700 (PDT) Date: Mon, 6 May 2024 13:43:29 -0600 From: Mathieu Poirier To: Beleswar Padhi Cc: andersson@kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, dan.carpenter@linaro.org, hnagalla@ti.com, devarsht@ti.com, nm@ti.com, s-anna@ti.com, u-kumar1@ti.com Subject: Re: [PATCH] remoteproc: k3-r5: Jump to error handling labels in start/stop errors Message-ID: References: <20240506141849.1735679-1-b-padhi@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240506141849.1735679-1-b-padhi@ti.com> On Mon, May 06, 2024 at 07:48:49PM +0530, Beleswar Padhi wrote: > In case of errors during core start operation from sysfs, the driver > directly returns with the -EPERM error code. Fix this to ensure that > mailbox channels are freed on error before returning by jumping to the > 'put_mbox' error handling label. Similarly, jump to the 'out' error > handling label to return with required -EPERM error code during the > core stop operation from sysfs. > > Fixes: 3c8a9066d584 ("remoteproc: k3-r5: Do not allow core1 to power up before core0 via sysfs") > > Signed-off-by: Beleswar Padhi > --- > As stated in the bug-report[0], Smatch complains that: > drivers/remoteproc/ti_k3_r5_remoteproc.c:583 k3_r5_rproc_start() warn: missing unwind goto? > drivers/remoteproc/ti_k3_r5_remoteproc.c:651 k3_r5_rproc_stop() warn: missing unwind goto? > > This patch addresses the warnings by jumping to appropriate error > labels in case an error occurs during start/stop operation from sysfs. > > [0]-https://lore.kernel.org/all/acc4f7a0-3bb5-4842-95a5-fb3c3fc8554b@moroto.mountain/ > > drivers/remoteproc/ti_k3_r5_remoteproc.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c > index 1799b4f6d11e..50e486bcfa10 100644 > --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c > +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c > @@ -580,7 +580,8 @@ static int k3_r5_rproc_start(struct rproc *rproc) > if (core != core0 && core0->rproc->state == RPROC_OFFLINE) { > dev_err(dev, "%s: can not start core 1 before core 0\n", > __func__); > - return -EPERM; > + ret = -EPERM; > + goto put_mbox; > } > > ret = k3_r5_core_run(core); > @@ -648,7 +649,8 @@ static int k3_r5_rproc_stop(struct rproc *rproc) > if (core != core1 && core1->rproc->state != RPROC_OFFLINE) { > dev_err(dev, "%s: can not stop core 0 before core 1\n", > __func__); > - return -EPERM; > + ret = -EPERM; > + goto out; > } Applied Thanks, Mathieu > > ret = k3_r5_core_halt(core); > -- > 2.34.1 >