Re: [PATCH v2] gpiolib: Fix triggering "kobject: 'gpiochipX' is not initialized, yet" kobject_get() errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 2, 2024 at 7:43 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> When a gpiochip gets added by loading a module, then another driver may
> be waiting for that gpiochip to load on the deferred-probe list.
>
> If the deferred-probe for the consumer of gpiochip then triggers between
> the gpiodev_add_to_list_unlocked() calls which makes gpio_device_find()
> see the chip and the gpiochip_setup_dev() later then gpio_device_find()
> does a kobject_get() on an uninitialzed kobject since the kobject is

uninitialized

> initialized by gpiochip_setup_dev() calling device_initialize():
>
>  arizona spi-10WM5102:00: cannot find GPIO chip arizona, deferring
>  arizona spi-10WM5102:00: cannot find GPIO chip arizona, deferring
>  ------------[ cut here ]------------
>  kobject: 'gpiochip5' (00000000241466f2): is not initialized, yet kobject_get() is being called.
>  WARNING: CPU: 3 PID: 42 at lib/kobject.c:640 kobject_get+0x43/0x70
>  Call Trace:
>   kobject_get
>   gpio_device_find
>   gpiod_find_and_request
>   gpiod_get
>   snd_byt_wm5102_mc_probe
>
> Not only is the device not initialized yet, but when the gpio-device is
> added to the list things like the irqchip also have not been initialized
> yet.
>
> So gpio_device_find() should really ignore the gpio-device until
> gpiochip_add_data_with_key() is fully done. Add a device_is_registered()
> check to gpio_device_find() to ignore gpio-devices on the list which are
> not yet fully initialized.

Reviewed-by: Andy Shevchenko <andy@xxxxxxxxxx>

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux