From nobody Tue Sep 29 04:08:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0DD7844E041 for ; Wed, 12 Aug 2026 14:20:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786544430; cv=none; b=oycXOP4vRxCnIRJW1OhLLYwVDCVcLOUOhl0ggLL0sk9CgBVJaZoH9+sqQ2WQNwbbe7hSx4QZhlfvYTI+SivnTANHqE7ll1Qutm84gK4tCUszi7kyy7QF5Rbnix1yzQ6GAokLhwC/KOWQk/MEsrP+AT/P88YX2qJncN5i2MISuTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786544430; c=relaxed/simple; bh=oeZfOb3yMlzgZ6U+x6LQ+R8Wx+b/NSvf1PN/ab84Lsk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vn1RWLyGHJiS97xq+kw6LMaQ1jI0zUqLlmACZopM6k8d7mbeCpOonud5IIVlTHSXRvzF5Ulzhfy+eTmJ07457245XdPVR0cLiKjPDVARlpWTyQ7gk0IbUsSAPX6nnJD1c3TfDxopXofZlHBYhchhgHviNI0gdEWldHVSyQppdUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eQ4YzCSs; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eQ4YzCSs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8DB61F00ADE; Wed, 12 Aug 2026 14:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786544428; bh=CDLz+Mc42aHxy/v7Uem4HL7pasWmvjBSSIEq0pceeCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eQ4YzCSs3LRL46v83L7Rn44ToT3bZ0x/2CTe3cwSdvODDVqtlPFfc+4/ju6K5iOsY w9TIs1LOEQyFej+iPRsEkitMVYBt+iajLfPm94f5hoiukWZOzUtCL6k4n9H/f4qfMi OjHt2KvN4UIFlp8lr3J1QDii+mC7eVEKnjGqNyyPlGezLTn1DXDgTeEk3U17liAC3+ 4shZtpU/YI4dq2KJVKNL1aYDA6IT76cTttpjgWHR2Ei2fBTttLex4Gu6/TZMQK4laO B5WPGTgV9i20VKrXqhYxsZscHbHZ6KFSovst7EY2P8skZmsOXPnKPR1zYxTGoAMSIU gmaQkTpc0NqZg== Received: from johan by xi.lan with local (Exim 4.99.4) (envelope-from ) id 1wu9og-00000000ELh-26Rr; Wed, 12 Aug 2026 16:20:26 +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 RESEND 1/3] powerpc/ps3: switch to dynamic system bus root device Date: Wed, 12 Aug 2026 16:20:14 +0200 Message-ID: <20260812142016.55136-2-johan@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260812142016.55136-1-johan@kernel.org> References: <20260812142016.55136-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.54.0 From nobody Tue Sep 29 04:08:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0DE27453A3B for ; Wed, 12 Aug 2026 14:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786544430; cv=none; b=mykRsiokk9Z28UOu5kVV9kl6qB6PFPHR26BeJTMXh+LE8YBKW5zSshzsKlHHw/0b/qKYpJgAH4//XsVr9xvSUAP08Dn5p3GBCckQYaa+JjoWxn1SI+i2TSWUkUdyqFxxy4Ck17k4UTbRJMm2bh2/2sIrUvyl+zjUmTiexbIgubA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786544430; c=relaxed/simple; bh=fXuRtCOIMbiEVQ0RG2k3Ks6dfzhYNlmpB9Wft6NfpnA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gt4lKNyJJAbEBzofg55oIXuax2XnSJ5YmvJwelbbE2ufU8YR/SqG/baxT6QcwcR9h6t+q2++VaL6j8hu/qZua5L0CkUxppwr77FcB4YDpUnNFNnDznuutFrCK6yV6sgR3XUUkX6wPH2Kkwk+M7qgsfb3U8pLLPNL/KeRi+ZgOis= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gszUJ8Gh; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gszUJ8Gh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB6761F00A3A; Wed, 12 Aug 2026 14:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786544428; bh=P7iOr3nQ+DZjRKBXriTn+qJo7TLaZ9kPfjGghjh5ty8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gszUJ8Gh/6zGJ5FUSb8cczQIrcov9KAGSOHDGMsH0gg9ohT5yJcd8kF42asYXXx31 O29GbsLjDDNGQB1v/4T5aZna4Q4q9Rs636GYThmUOOPBw/dke7D3+aiq/PYT9Q5ZSf vPYcOV4yoYI1VsUl7EglSNm+G34+vVz14jUJGsR4klQeG/RwO+pVWuopquulvtVm5I hL9ca0oCFqdwdiziVu3eU+UXcJs2Bv4Eb8fiDIn/zT6AeLGOfzwW6jQn8FrjQGcggo ROpo7TPGeFP3vJT9OdxbMkP1YmftGvdIP2K0uo/9F6eg8+4YxSOPaFsdjZE7p+T8/V 59iTNocwij4ag== Received: from johan by xi.lan with local (Exim 4.99.4) (envelope-from ) id 1wu9og-00000000ELj-29UR; Wed, 12 Aug 2026 16:20:26 +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 RESEND 2/3] powerpc/pseries: switch to dynamic ibmebus root device Date: Wed, 12 Aug 2026 16:20:15 +0200 Message-ID: <20260812142016.55136-3-johan@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260812142016.55136-1-johan@kernel.org> References: <20260812142016.55136-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 2d0f991da2c8..48076fe6ab30 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c @@ -52,9 +52,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 @@ -172,7 +170,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 @@ -448,6 +449,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"); @@ -459,23 +461,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.54.0 From nobody Tue Sep 29 04:08:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0DCE344838E for ; Wed, 12 Aug 2026 14:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786544430; cv=none; b=H3ORc85tOwCWXsjq9WSxBgPUXsKNi46UymM8NxBV8ClFwkDf0OxGI0Rk0ofUFaMDyDaN7+igwgX/QUWuuOoesGWx+jCasqm34jKoXjXtxbJXUS9cTaWGPV/vcy658HqXzkdH9iCpNrQqn7lC/Erzbf2Z2QcamFdT4z4j1NtWvzA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786544430; c=relaxed/simple; bh=3hCa+RHi/j9BsggpbbKvekF+aCJNcfD836IJVxxI6Sw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mkv1GlX4dqISxCGJMlvWaUwI1YbMfBZ9tqyovn62drxY9ZRxnAuo38eOICUTu2mDwhBOeKGNgEC0NidvzpieKvm6b+UJbS5KmAVGuErfWqufmoHZ/Sv0bhj6AZJLuP0YmNICWNCqDGva6oVim6srcl89BlXdn/V9rqjjs/AC1IE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ov4KQ6s7; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ov4KQ6s7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD7541F00A3D; Wed, 12 Aug 2026 14:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786544428; bh=KfFenigtBlsUpFRETS//72mmdEApLGPYa9j/QhUpp9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ov4KQ6s7XREh3KkEiSJ5ofqlWdsuK0cZBAh+aT0P+rFCzcO9W3DYsSadBhFht/xFs 3O7mgAT6TPE6PEAx3tHWwDIJ4hpfU9tnCKwwUfp/z0v7yUDsTFH6TTI9Euy430+ExQ lqOblFV3jsdgUF/Dkbyt5RUn9YdWlm2OQBWQI8537ttymtnhrKoVOBk/xO0XdGSCSG 6r7UxiZMQeQpfoW++VcQ3cHoEWIHXCK7SBH/ki47KPym7aXqGEWMpDu+gE71PzqIqY bUoZH+IY8LuoHVqoRlBlYy4cojeZrtssQ9mbKKwALX8Qw2rEEGZUjHNTbXejcFBnbe smD7+u1JNVkSQ== Received: from johan by xi.lan with local (Exim 4.99.4) (envelope-from ) id 1wu9og-00000000ELl-2Bzn; Wed, 12 Aug 2026 16:20:26 +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 RESEND 3/3] powerpc/pseries: clean up ibmebus printks Date: Wed, 12 Aug 2026 16:20:16 +0200 Message-ID: <20260812142016.55136-4-johan@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260812142016.55136-1-johan@kernel.org> References: <20260812142016.55136-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 48076fe6ab30..5cfb0565e712 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c @@ -207,8 +207,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; } @@ -286,8 +285,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; } @@ -296,8 +294,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 @@ -326,8 +323,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; @@ -452,20 +448,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.54.0