lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2026012354-stinging-lapdog-2a54@gregkh>
Date: Fri, 23 Jan 2026 15:19:39 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Danilo Krummrich <dakr@...nel.org>
Cc: rafael@...nel.org, broonie@...nel.org, will@...nel.org,
	grygorii.strashko@...com, ssantosh@...nel.org, khilman@...nel.org,
	linusw@...nel.org, brgl@...nel.org, driver-core@...ts.linux.dev,
	linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
	linux-gpio@...r.kernel.org
Subject: Re: [PATCH] gpio: omap: do not register driver in probe()

On Fri, Jan 23, 2026 at 02:57:45PM +0100, Danilo Krummrich wrote:
> On Fri Jan 23, 2026 at 2:31 PM CET, Danilo Krummrich wrote:
> > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> > index e136e81794df..8db71a2db9ff 100644
> > --- a/drivers/gpio/gpio-omap.c
> > +++ b/drivers/gpio/gpio-omap.c
> > @@ -800,9 +800,7 @@ static struct platform_device omap_mpuio_device = {
> >  static inline void omap_mpuio_init(struct gpio_bank *bank)
> >  {
> >  	platform_set_drvdata(&omap_mpuio_device, bank);
> > -
> > -	if (platform_driver_register(&omap_mpuio_driver) == 0)
> > -		(void) platform_device_register(&omap_mpuio_device);
> > +	(void)platform_device_register(&omap_mpuio_device);
> >  }
> 
> On a second look, it recognize that this did abuse the fact that
> platform_driver_register() fails when attempting to register a driver multiple
> times to avoid registering the same static device multiple times.
> 
> So, I guess this has to be changed to:
> 
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index 8db71a2db9ff..3e1ac34994fb 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -799,8 +799,13 @@ static struct platform_device omap_mpuio_device = {
> 
>  static inline void omap_mpuio_init(struct gpio_bank *bank)
>  {
> +       static bool registered = false;
> +
>         platform_set_drvdata(&omap_mpuio_device, bank);
> -       (void)platform_device_register(&omap_mpuio_device);
> +       if (!registered) {
> +               (void)platform_device_register(&omap_mpuio_device);
> +               registered = true;
> +       }
>  }

But there are no platform resources for this at all, shouldn't this be a
faux device instead?

That being said, ignoring the return value of platform_device_register()
is probably not something we want to keep around.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ