From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 894343A59FB; Sat, 28 Feb 2026 17:37:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300274; cv=none; b=pV9j3/1b77FqK3JO/cpAGED/h/4hY3ml/pTINzTJNiW5VZ5HZxSjqROqA429pf/jLy/YW0T37yYFH0gXrzRm5/y9+VlfWS+05oLQiahxzRK1uFPMGf6s4xLEKt3+OndnDqkGJZ63CY2XU8DjqVmqeGjsWaoYC8mB3fS/WbkxHVg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300274; c=relaxed/simple; bh=e3ZXd0XXxi0wpZ4x26jBB6Oe3mMb01vU4qY4HNeryYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bQXZ+35vDowg2Bjv3z4g5otkQ4GkWBAiOwr5XPjPk9ThFWOIML/20AA/auBeTgIISn/pMj5ufOB/Ui+ZTA8G5ENPDwttHDgTfSxAL9VNonwlfRWKrrOo7NIl7nla+tLqmTflcVaZ/AQbQ0r/9WEv62u7nLWmYWaWrHCXcCt6800= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cOZnsK2K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cOZnsK2K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C340FC19423; Sat, 28 Feb 2026 17:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300274; bh=e3ZXd0XXxi0wpZ4x26jBB6Oe3mMb01vU4qY4HNeryYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cOZnsK2KCTG9UN79TBPdr2xG4oY8ZL1EmKK02mXiDVJ4BDaoMTwnV7TKWu1fQQorN NqScjvAhjscD48lYOR4rWeBJ9hT4URfeHZ1OAfntg0x1Y0pqSiWcGSyeUhDIiS39Gn tEUoO7PI/wcvhK5vS9D3vdUMuO0IKRRaA9Fl94tbd9tsyfrHsCksXmj/PGY6iNGIJU T3mUisSEld1hfVVKBZtQIHtGAthYv4/0Pk4oBjGl+I4cMLl+uBRPcPMFYKDK5WSav0 qD7+8Cbl1TQtwS1HKCvVCBwpCsU29V/8tFn6l7A0b8nN28IL7D3jiN0N5Xiam/xRKF w7MNCja5LR7Dw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Gui-Dong Han , Danilo Krummrich , Sasha Levin Subject: [PATCH 6.19 301/844] driver core: faux: stop using static struct device Date: Sat, 28 Feb 2026 12:23:34 -0500 Message-ID: <20260228173244.1509663-302-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman [ Upstream commit 61b76d07d2b46a86ea91267d36449fc78f8a1f6e ] faux_bus_root should not have been a static struct device, but rather a dynamically created structure so that lockdep and other testing tools do not trip over it (as well as being the right thing overall to do.) Fix this up by making it properly dynamic. Reported-by: Gui-Dong Han Closes: https://lore.kernel.org/lkml/CALbr=LYKJsj6cbrDLA07qioKhWJcRj+gW8=bq5=4ZvpEe2c4Yg@mail.gmail.com/ Reviewed-by: Danilo Krummrich Link: https://patch.msgid.link/2026012145-lapping-countless-ef81@gregkh Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/base/faux.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/base/faux.c b/drivers/base/faux.c index 21dd02124231a..23d7258172325 100644 --- a/drivers/base/faux.c +++ b/drivers/base/faux.c @@ -29,9 +29,7 @@ struct faux_object { }; #define to_faux_object(dev) container_of_const(dev, struct faux_object, faux_dev.dev) -static struct device faux_bus_root = { - .init_name = "faux", -}; +static struct device *faux_bus_root; static int faux_match(struct device *dev, const struct device_driver *drv) { @@ -152,7 +150,7 @@ struct faux_device *faux_device_create_with_groups(const char *name, if (parent) dev->parent = parent; else - dev->parent = &faux_bus_root; + dev->parent = faux_bus_root; dev->bus = &faux_bus_type; dev_set_name(dev, "%s", name); device_set_pm_not_required(dev); @@ -236,9 +234,15 @@ int __init faux_bus_init(void) { int ret; - ret = device_register(&faux_bus_root); + faux_bus_root = kzalloc(sizeof(*faux_bus_root), GFP_KERNEL); + if (!faux_bus_root) + return -ENOMEM; + + dev_set_name(faux_bus_root, "faux"); + + ret = device_register(faux_bus_root); if (ret) { - put_device(&faux_bus_root); + put_device(faux_bus_root); return ret; } @@ -256,6 +260,6 @@ int __init faux_bus_init(void) bus_unregister(&faux_bus_type); error_bus: - device_unregister(&faux_bus_root); + device_unregister(faux_bus_root); return ret; } -- 2.51.0