From nobody Sun Feb 8 06:05:38 2026 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5432623C4F3 for ; Fri, 19 Sep 2025 16:07:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758298035; cv=none; b=p8vWvBJZwCMrKsYL/f0EbL/yr0GBGNQpWHJ8A+W84XLnrFYfaP52wufwmk1LzPzfsiAJJ7BAkgrcUbcQVRk9haVendehEEM8JHeldPoUdN3d6ItCXL/8oXsdsMg8Vv/NOBXGUjAmF60rvTNSS1Ig77t2wb9BUz8YkI2x2Ka5Y94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758298035; c=relaxed/simple; bh=Zkf4labI49fgjP/HEegGogYjo29jkFb/3BULoc5Bqnc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VxH7FjfUq98Rrou/7bUWsBoSQpX1PWkZpRhU/PArEEetiLiY4tppp6h6sVFhyIyiyQLXmK9OWkpBuKtDCA6uvbS/nSidwjqhpRDfZ/AJgHCtqxkzZ5uXvS4x93JwciTLdMcQkCl6z8KlFzCIXRzUYLongetj/qt4kdU6WAc+mQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=aDtWBw75; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="aDtWBw75" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1758298030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pewuq/6rdA5KtkL6k1lLoSccaVHqQNLVmKiQfNeqa94=; b=aDtWBw75kNoVs/Ue2TDQfvKyZcBBG3whUZfr+yqPzDQCmPzrj5IvEFQVe0ou0GzzB44Zks bNK33hSuM7rQN7UzNVYZMiR5wOB3jEH/pJjSZhIgYHoXPXunihQvwzdYJarGaOuTbUGfUg DrS98w2Q4L79AInszSTzPqHtrtD9PVg= From: Sean Anderson To: Suzuki K Poulose , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Cc: James Clark , Alexander Shishkin , Yeoreum Yun , Leo Yan , Linu Cherian , Mike Leach , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v4 1/2] coresight: Fix fwnode leak in coresight_register error path Date: Fri, 19 Sep 2025 12:06:52 -0400 Message-Id: <20250919160653.507109-2-sean.anderson@linux.dev> In-Reply-To: <20250919160653.507109-1-sean.anderson@linux.dev> References: <20250919160653.507109-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" If registering the CPU map fails, we need to put the fwnode. free_percpu works when called with a NULL pointer, so just use coresight_device_release. Fixes: 5ad628a76176 ("coresight: Use per-sink trace ID maps for Perf sessio= ns") Signed-off-by: Sean Anderson --- Changes in v4: - New drivers/hwtracing/coresight/coresight-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtraci= ng/coresight/coresight-core.c index fa758cc21827..022c8384b98d 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1352,7 +1352,7 @@ struct coresight_device *coresight_register(struct co= resight_desc *desc) raw_spin_lock_init(&csdev->perf_sink_id_map.lock); csdev->perf_sink_id_map.cpu_map =3D alloc_percpu(atomic_t); if (!csdev->perf_sink_id_map.cpu_map) { - kfree(csdev); + coresight_device_release(&csdev->dev); ret =3D -ENOMEM; goto err_out; } --=20 2.35.1.1320.gc452695387.dirty