From nobody Fri Jun 19 10:14:24 2026 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 4C1303385B6 for ; Fri, 24 Apr 2026 16:03:52 +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=1777046632; cv=none; b=DO18kLNpxI0UEYteNodh+22q30Akb7e1lXg1EoE0PCHU/tKEhwzJDjqmg5fiE6QiuNYaveYwZzWvEYff6/f2LjNVU1tKi6AOBMRBWoH0UKHpbsJuobFBZivEAq0JwxXsi80mIsHZWXNASM2i5/rMXZMwK2kAdcP49iwS86JVB/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777046632; c=relaxed/simple; bh=OpjYnvUINC0m/fERNUlL4a3+lpA8IFC0Re5p9y/suRY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gP49oA7XgwYmIxehzBlbF2KSDjlolqDN5UWsOhzOWV7tuDyO5bZymuBDK0veEV+yx5d64cofyY27tVYEOZlq8nKRHB0+PJ7SfYW77nPmwamzSiqOxHnfiAsxVmJg7HzNPwESSSDWRl3XHhs0Qx7Ppybxhy30qrj/q2EHdriFu28= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kHPx5zDe; 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="kHPx5zDe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAF7CC19425; Fri, 24 Apr 2026 16:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777046632; bh=OpjYnvUINC0m/fERNUlL4a3+lpA8IFC0Re5p9y/suRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHPx5zDeAWeJIGcgZA6QqcJE9toft/blPMdaDaFKnu4DQf+K7B8fuF1ef4m2JhmKb 9t2l4/TtcsBjz+6bsUaSGseDixTCFT3GOqugf+F7o9a7Oy7EWNkJQ2eSuy5v/eHeco a0Xm4Dfzos6CG+I9ttnvmRpAluFfu+zIxB9kA8hvrn6WRlHMB+Y8risu8KQMznvdfj obiDYVOKkAbBlUJjhpqk+qbGwF50onmRd1MvmeOdj+7fKoG7OG0PL8F28aIcOOCG2x WC6NeRazMriMZ7eREcgtG+C/AMlxpbGbstDeaV8oXVU1nSvZD2pZeN67z65FrHXayE kts7z/a9NB3iQ== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1wGJ0P-0000000BDJd-3H6m; Fri, 24 Apr 2026 18:03:49 +0200 From: Johan Hovold To: Geoff Levand , Madhavan Srinivasan , Michael Ellerman Cc: Nicholas Piggin , Christophe Leroy , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v2 1/3] powerpc/ps3: switch to dynamic system bus root device Date: Fri, 24 Apr 2026 18:02:57 +0200 Message-ID: <20260424160259.2672722-2-johan@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424160259.2672722-1-johan@kernel.org> References: <20260424160259.2672722-1-johan@kernel.org> 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 Content-Type: text/plain; charset="utf-8" Driver core expects devices to be dynamically allocated and will, for example, complain loudly if a device that lacks a release function is ever freed. Use root_device_register() to allocate and register the root device instead of open coding using a static device. Signed-off-by: Johan Hovold --- arch/powerpc/platforms/ps3/system-bus.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platfor= ms/ps3/system-bus.c index 0537a678a32f..4ead6ccea259 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c @@ -20,9 +20,7 @@ =20 #include "platform.h" =20 -static struct device ps3_system_bus =3D { - .init_name =3D "ps3_system", -}; +static struct device *ps3_system_bus; =20 /* FIXME: need device usage counters! */ static struct { @@ -486,8 +484,8 @@ static int __init ps3_system_bus_init(void) =20 mutex_init(&usage_hack.mutex); =20 - result =3D device_register(&ps3_system_bus); - BUG_ON(result); + ps3_system_bus =3D root_device_register("ps3_system"); + BUG_ON(IS_ERR(ps3_system_bus)); =20 result =3D bus_register(&ps3_system_bus_type); BUG_ON(result); @@ -744,7 +742,7 @@ int ps3_system_bus_device_register(struct ps3_system_bu= s_device *dev) static unsigned int dev_lpm_count; =20 if (!dev->core.parent) - dev->core.parent =3D &ps3_system_bus; + dev->core.parent =3D ps3_system_bus; dev->core.bus =3D &ps3_system_bus_type; dev->core.release =3D ps3_system_bus_release_device; =20 --=20 2.53.0 From nobody Fri Jun 19 10:14:24 2026 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 4C09E77F39 for ; Fri, 24 Apr 2026 16:03:52 +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=1777046632; cv=none; b=kUjRY1AgMHr43p1s1cNlFc9LDEJ48FTc7gRr+8dSCFgHalZyIRe+3u8jEGrFZdiRIqQtuqd4E5FWMrC3QqMYKdgWrnchUGli2HPIgUUEyGfwwn7e9HD0Topt8gi3zp4TDj1CBj1fSKXYtO++nI28Z4j11IDW0inkh6mw7wpXy74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777046632; c=relaxed/simple; bh=HgtVi8OJ+/vIrStnMhO7W57bp79LE5Df42vhHHfdxpc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rxeoooVqQUIynZXI+MPymBZCATLLeloAgkmsHspBvuhlk+9mPieluJJx/bD98cNVe6yPxitAI2Qm/GVmGEN5HPJuQOv99OluCyIqpIjFSJIBdyo4qKHCsv8roL2nDr5Oy9EtOpMHtxWtaFh5kD7cpPVSs3h7Wn3JJIkYGIfcPQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hEBhmvJT; 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="hEBhmvJT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0621C2BCB6; Fri, 24 Apr 2026 16:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777046632; bh=HgtVi8OJ+/vIrStnMhO7W57bp79LE5Df42vhHHfdxpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hEBhmvJTHXvQyJNp44YCnJZdKEP4UG5PFKRk75M19GsVhhMcH5E4nrHgVOPb+qeYD fzYCaz14564Tkrulxn2oOzAEYVzviqEDq7VkaTKGdh8tY5OFhps/ybTui0rPuqMFV2 fBCyWBDQU7SlJfJSADfgYHrtlQemdwnjq6FRePMVT7hakj4KqgPGI7Nz2qXFJYHk6Z FC4VKzDpsPiLPFhwUxLy3Ji4OFXIqJOaAbsboz+Vq/P7RZu+uqxRWr0/OVq7J4xDRi WBn2F7wFm9Se5/81BzPHPN+JBjpmxuyuiooRyAn61DFsAffY+8LqPiafGXxaQdKSrV Fbca3UoWcgPIw== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1wGJ0P-0000000BDJf-3JTr; Fri, 24 Apr 2026 18:03:49 +0200 From: Johan Hovold To: Geoff Levand , Madhavan Srinivasan , Michael Ellerman Cc: Nicholas Piggin , Christophe Leroy , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v2 2/3] powerpc/pseries: switch to dynamic ibmebus root device Date: Fri, 24 Apr 2026 18:02:58 +0200 Message-ID: <20260424160259.2672722-3-johan@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424160259.2672722-1-johan@kernel.org> References: <20260424160259.2672722-1-johan@kernel.org> 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 Content-Type: text/plain; charset="utf-8" Driver core expects devices to be dynamically allocated and will, for example, complain loudly if a device that lacks a release function is ever freed. Use root_device_register() to allocate and register the root device instead of open coding using a static device. Also add the missing sanity check when registering ibmebus devices to avoid use-after-free if the bus failed to register (which would previously have triggered a bunch of use-after-free warnings). Signed-off-by: Johan Hovold --- arch/powerpc/platforms/pseries/ibmebus.c | 39 ++++++++++++++---------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platfo= rms/pseries/ibmebus.c index cad2deb7e70d..f2064e0b975d 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c @@ -51,9 +51,7 @@ #include #include =20 -static struct device ibmebus_bus_device =3D { /* fake "parent" device */ - .init_name =3D "ibmebus", -}; +static struct device *ibmebus_bus_device; /* fake "parent" device */ =20 const struct bus_type ibmebus_bus_type; =20 @@ -171,7 +169,10 @@ static int ibmebus_create_device(struct device_node *d= n) struct platform_device *dev; int ret; =20 - dev =3D of_device_alloc(dn, NULL, &ibmebus_bus_device); + if (!ibmebus_bus_device) + return -ENOENT; + + dev =3D of_device_alloc(dn, NULL, ibmebus_bus_device); if (!dev) return -ENOMEM; =20 @@ -447,6 +448,7 @@ EXPORT_SYMBOL(ibmebus_bus_type); =20 static int __init ibmebus_bus_init(void) { + struct device *root; int err; =20 printk(KERN_INFO "IBM eBus Device Driver\n"); @@ -458,23 +460,28 @@ static int __init ibmebus_bus_init(void) return err; } =20 - err =3D device_register(&ibmebus_bus_device); - if (err) { - printk(KERN_WARNING "%s: device_register returned %i\n", + root =3D root_device_register("ibmebus"); + if (IS_ERR(root)) { + err =3D PTR_ERR(root); + printk(KERN_WARNING "%s: root_device_register returned %i\n", __func__, err); - put_device(&ibmebus_bus_device); - bus_unregister(&ibmebus_bus_type); - - return err; + goto err_deregister_bus; } =20 + ibmebus_bus_device =3D root; + err =3D ibmebus_create_devices(ibmebus_matches); - if (err) { - device_unregister(&ibmebus_bus_device); - bus_unregister(&ibmebus_bus_type); - return err; - } + if (err) + goto err_deregister_root; =20 return 0; + +err_deregister_root: + ibmebus_bus_device =3D NULL; + root_device_unregister(root); +err_deregister_bus: + bus_unregister(&ibmebus_bus_type); + + return err; } machine_postcore_initcall(pseries, ibmebus_bus_init); --=20 2.53.0 From nobody Fri Jun 19 10:14:24 2026 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 4C1DA363086 for ; Fri, 24 Apr 2026 16:03:52 +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=1777046632; cv=none; b=ELZBpJ4fadf+uLxGFOjZCyWKH0YL0T97RRQj8PQCwKi6AptDuq2cqa+h1q8HJHXDjjJ/BB5Wj4xhG9M5SIMw5wwX+Jocu3Q5bOJcl/9ayvm+cDt24sDWkMZHyNi/fsyagdGDPN6CJ5Uo184t9BITYJnTY+hUOrPGmJJzU3h/k8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777046632; c=relaxed/simple; bh=mqneH79EzeFeOxrWkixTrTTzC47bHkuPKa7R4p811E0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XsumpzY7mB1u8FiPdQHkemW20nFz9mFY+eEyMUl/KMyu0p33Yjib3zhY5wCtgkViiUbR99wqz2Dj8oAaFocyfrBGGzrWVpBtrWH6VOUKAVGSXSmJwRGhk/wxFyXR7YsAEIBD1gZxpa7PtiLhyuwW5Pjn87ZAme3LweW7NoK1Eds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r+d0lrtA; 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="r+d0lrtA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2AF9C4AF09; Fri, 24 Apr 2026 16:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777046632; bh=mqneH79EzeFeOxrWkixTrTTzC47bHkuPKa7R4p811E0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+d0lrtAK3edmQEWczLVMByJvn0kIOzzMnds3YFkbiPrX1r3WRvzC8exTrN+1nJIF /PgMNBXy1lU5/HS6P53nIZyZv+dQoXvB/FAVAwBIZK401OuPCWowGf7i5NWRQVFTi3 dGegIUJsNmZOSofyzTkO286YEL2QUVjKQhRRld02seX2Z+MVupWjstk4IzZPUnD+UA c8OMJ8+3n9oXDmwTOm3EZ96Vr0MAYK2PfyJcfEtDv4ZHpu46msW/TOWCgCKKpaDxJv jcFJVELPANYwkLtKNwxUDdCVyC0+gxergtuoMzjBP7pUKe5RPAUTyjm2lvoEbphzJL fXEFjfnvLYQBA== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1wGJ0P-0000000BDJh-3Lxr; Fri, 24 Apr 2026 18:03:49 +0200 From: Johan Hovold To: Geoff Levand , Madhavan Srinivasan , Michael Ellerman Cc: Nicholas Piggin , Christophe Leroy , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v2 3/3] powerpc/pseries: clean up ibmebus printks Date: Fri, 24 Apr 2026 18:02:59 +0200 Message-ID: <20260424160259.2672722-4-johan@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424160259.2672722-1-johan@kernel.org> References: <20260424160259.2672722-1-johan@kernel.org> 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 Content-Type: text/plain; charset="utf-8" Clean up the imbebus printks by switching to pr_warn() and pr_err(), adding a missing newline and making the error messages a bit more uniform. Signed-off-by: Johan Hovold --- arch/powerpc/platforms/pseries/ibmebus.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platfo= rms/pseries/ibmebus.c index f2064e0b975d..24c3ec76b0c1 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c @@ -206,8 +206,7 @@ static int ibmebus_create_devices(const struct of_devic= e_id *matches) =20 ret =3D ibmebus_create_device(child); if (ret) { - printk(KERN_ERR "%s: failed to create device (%i)", - __func__, ret); + pr_err("%s: failed to create device: %d\n", __func__, ret); of_node_put(child); break; } @@ -285,8 +284,7 @@ static ssize_t probe_store(const struct bus_type *bus, = const char *buf, size_t c ibmebus_match_path); if (dev) { put_device(dev); - printk(KERN_WARNING "%s: %s has already been probed\n", - __func__, path); + pr_warn("%s: %s has already been probed\n", __func__, path); rc =3D -EEXIST; goto out; } @@ -295,8 +293,7 @@ static ssize_t probe_store(const struct bus_type *bus, = const char *buf, size_t c rc =3D ibmebus_create_device(dn); of_node_put(dn); } else { - printk(KERN_WARNING "%s: no such device node: %s\n", - __func__, path); + pr_warn("%s: no such device node: %s\n", __func__, path); rc =3D -ENODEV; } =20 @@ -325,8 +322,7 @@ static ssize_t remove_store(const struct bus_type *bus,= const char *buf, size_t kfree(path); return count; } else { - printk(KERN_WARNING "%s: %s not on the bus\n", - __func__, path); + pr_warn("%s: %s not on the bus\n", __func__, path); =20 kfree(path); return -ENODEV; @@ -451,20 +447,18 @@ static int __init ibmebus_bus_init(void) struct device *root; int err; =20 - printk(KERN_INFO "IBM eBus Device Driver\n"); + pr_info("IBM eBus Device Driver\n"); =20 err =3D bus_register(&ibmebus_bus_type); if (err) { - printk(KERN_ERR "%s: failed to register IBM eBus.\n", - __func__); + pr_err("%s: failed to register IBM eBus\n", __func__); return err; } =20 root =3D root_device_register("ibmebus"); if (IS_ERR(root)) { err =3D PTR_ERR(root); - printk(KERN_WARNING "%s: root_device_register returned %i\n", - __func__, err); + pr_err("%s: failed to register root device: %d\n", __func__, err); goto err_deregister_bus; } =20 --=20 2.53.0