android_kernel_motorola_sm6375/arch/sparc
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ma Ke bf70d603af sparc: fix error handling in scan_one_device()
commit 302c04110f0ce70d25add2496b521132548cd408 upstream.

Once of_device_register() failed, we should call put_device() to
decrement reference count for cleanup. Or it could cause memory leak.
So fix this by calling put_device(), then the name can be freed in
kobject_cleanup().

Calling path: of_device_register() -> of_device_add() -> device_add().
As comment of device_add() says, 'if device_add() succeeds, you should
call device_del() when you want to get rid of it. If device_add() has
not succeeded, use only put_device() to drop the reference count'.

Found by code review.

Cc: [email protected]
Fixes: cf44bbc26c ("[SPARC]: Beginnings of generic of_device framework.")
Signed-off-by: Ma Ke <[email protected]>
Reviewed-by: Andreas Larsson <[email protected]>
Signed-off-by: Andreas Larsson <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2025-10-29 13:59:53 +01:00
..
boot
configs
crypto
include sparc64: Fix incorrect function signature and add prototype for prom_cif_init 2024-08-19 05:33:32 +02:00
kernel sparc: fix error handling in scan_one_device() 2025-10-29 13:59:53 +01:00
lib sparc: fix accurate exception reporting in copy_{from,to}_user for M7 2025-10-29 13:59:49 +01:00
math-emu
mm sparc64: fix hugetlb for sun4u 2025-10-29 13:59:53 +01:00
net
oprofile
power
prom sparc64: Fix incorrect function signature and add prototype for prom_cif_init 2024-08-19 05:33:32 +02:00
vdso sparc: vDSO: fix return value of __setup handler 2024-04-13 12:51:22 +02:00
Kbuild
Kconfig sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
Kconfig.debug
Makefile