mirror of
https://github.com/LineageOS/android_kernel_samsung_msm8226.git
synced 2026-10-10 00:00:43 +02:00
msm_hs_config_port function acquires spinlock before calling msm_hs_request_port function where it calls request_mem_region to claim gsbi resource and ioremap the same. As request_mem_region calls kmem_cache_alloc which can sleep, enabling CONFIG_DEBUG_SPINLOCK_SLEEP shows below stacktrace complaining about sleeping in invalid context. BUG: sleeping function called from invalid context at mm/slub.c:795 in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper INFO: lockdep is turned off. irq event stamp: 52269 hardirqs last enabled at (52268): kmem_cache_free+0xc8/0xd8 hardirqs last disabled at (52269): _raw_spin_lock_irqsave+0x18/0x5c softirqs last enabled at (49209): irq_exit+0x54/0xa8 softirqs last disabled at (49192): irq_exit+0x54/0xa8 (unwind_backtrace+0x0/0x124) from (kmem_cache_alloc+0x3c/0xf0) (kmem_cache_alloc+0x3c/0xf0) from (__request_region+0x64/0x150) (__request_region+0x64/0x150) from (msm_hs_request_port+0x4c/0x9c) (msm_hs_request_port+0x4c/0x9c) from (msm_hs_config_port+0x2c/0x78) (msm_hs_config_port+0x2c/0x78) from (uart_add_one_port+0x144/0x370) (uart_add_one_port+0x144/0x370) from (msm_hs_probe+0x5c8/0x678) (msm_hs_probe+0x5c8/0x678) from (platform_drv_probe+0x18/0x1c) (platform_drv_probe+0x18/0x1c) from (driver_probe_device+0x140/0x254) (driver_probe_device+0x140/0x254) from (__driver_attach+0x68/0x8c) (__driver_attach+0x68/0x8c) from (bus_for_each_dev+0x44/0x74) (bus_for_each_dev+0x44/0x74) from (bus_add_driver+0xc8/0x254) (bus_add_driver+0xc8/0x254) from (driver_register+0xa8/0x134) (driver_register+0xa8/0x134) from (platform_driver_probe+0x18/0x8c) (platform_driver_probe+0x18/0x8c) from (msm_serial_hs_init+0x68/0xc8) (msm_serial_hs_init+0x68/0xc8) from (do_one_initcall+0xc8/0x1a0) (do_one_initcall+0xc8/0x1a0) from (kernel_init+0x150/0x218) (kernel_init+0x150/0x218) from (kernel_thread_exit+0x0/0x8) This change fixes the above mentioned issue. CRs-Fixed: 307667 Signed-off-by: Mayank Rana <mrana@codeaurora.org>