From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA98B606A31C for ; Mon, 30 Nov 2026 10:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=YL7ZKUWm; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=X7o1i/um DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=vG+5xfI41FTjiG7Ij+QJz+Q4gPm56mQfgmcJLpQzZuk=; b=YL7ZKUWmMDxHG6 o6gze8R2b6f8I8K3xBQgfktFyGXBzXHXVuKbyFOnO6TCRo6SOI038Na0rQ7416L8ChW3ZjTW5g0mX 82nLF1OQ+1Q8C2AkhWekXPoSmvp+lz0IIncg7n+9zh46OKBmsO5x89Vb4RTGZBE778ZLJMxfEaaeh fOTc4BJudPIS80I9To2wxYSP2IJLRNwVgBMJCeF+AYBL/0tBex3V7xHO2JoF79JkYNWIfNvZmD10c g5KP16VnbODNywSJAt90qcn9A4w0z1DGXNIFVX8jTNdJqUU0Rpa1eWQ6NptYeN+lmlkSsA45mIJ3u PhxfMt4oFoJEt5TubQNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXywy-00000004CRq-1tr7; Mon, 30 Nov 2026 10:49:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXywv-00000004CR7-2MOK for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2026 10:49:34 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 706ED1570; Mon, 30 Nov 2026 02:49:27 -0800 (PST) Received: from [10.57.35.136] (unknown [10.57.35.136]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 546B53F86F; Mon, 30 Nov 2026 02:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796035770; bh=K0i0SPor28zk0zS3Y8NbS5vGThNwROKE7jFyfu5HAPk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=X7o1i/um/MEL8C6lrHR9JTnnxuhIFgYtsocGeoi6nXJZr1Pu8z/CABSmMsUQl5Zdr p4IfrWlHqYcyA7MeP8G+crL4LjtVDV/sZPw8Mroo4kcn8dVjre301Z6muF64m0/3Hk WiEsiZ61hI7NhfjqW2YEfFmgmTD/+x3S9a39AZtg= Message-ID: <840945af-7f07-4e3b-87ea-c585b0bec7d4@arm.com> Date: Mon, 30 Nov 2026 10:49:26 +0000 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] coresight: tmc: register the crash data interface only on probe success To: Jie Gan , Mike Leach , James Clark , Leo Yan , Alexander Shishkin , Tanmay Jagdale , Anil Kumar Reddy , Linu Cherian , Tingwei Zhang Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Sashiko References: <20261130-fix-tmc-issues-v1-0-fb0893a65bea@oss.qualcomm.com> <20261130-fix-tmc-issues-v1-1-fb0893a65bea@oss.qualcomm.com> Content-Language: en-GB From: Suzuki K Poulose In-Reply-To: <20261130-fix-tmc-issues-v1-1-fb0893a65bea@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261130_024933_672849_D4A1C452 X-CRM114-Status: GOOD ( 19.35 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 30/11/2026 09:22, Jie Gan wrote: > The crash data interface is registered after the out label of > __tmc_probe(), which every error path jumps to. When the probe fails > while the reserved regions hold valid crash data, > is_tmc_crashdata_valid() and tmc_prepare_crashdata() log through > drvdata->csdev, which is then NULL, an error pointer or an unregistered > device, and register_crash_dev_interface() can register a misc device > whose driver data is freed when the probe failure is unwound. > > Only register the crash data interface once the probe has succeeded. > > Fixes: d58a70bdab57 ("coresight: tmc: Add support for reading crash data") > Reported-by: Sashiko > Closes: https://sashiko.dev/#/bug/linux-f23df7b7-bae5-4fa0-96ef-4e83632058e8 > Signed-off-by: Jie Gan > --- > drivers/hwtracing/coresight/coresight-tmc-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c > index 0ef4b817b297..754a9b10b7d2 100644 > --- a/drivers/hwtracing/coresight/coresight-tmc-core.c > +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c > @@ -880,10 +880,10 @@ static int __tmc_probe(struct device *dev, struct resource *res) > goto out; > } > > -out: > if (is_tmc_crashdata_valid(drvdata) && > !tmc_prepare_crashdata(drvdata)) > register_crash_dev_interface(drvdata, desc.name); > +out: > return ret; > } > > Goto for retuning just the error code, doesn't look like a good practice. Please could we fix all goto out with return ? See: "The goto statement comes in handy when a function exits from multiple locations and some common work such as cleanup has to be done. *If there is no cleanup needed then just return directly.*" https://www.kernel.org/doc/html/latest/process/coding-style.html#centralized-exiting-of-functions Cheers Suzuki