]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
powerpc/warp: Fix error handling in pika_dtm_thread
authorMa Ke <make24@iscas.ac.cn>
Sun, 16 Nov 2025 02:44:11 +0000 (10:44 +0800)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Tue, 12 May 2026 06:19:30 +0000 (11:49 +0530)
pika_dtm_thread() acquires client through of_find_i2c_device_by_node()
but fails to release it in error handling path. This could result in a
reference count leak, preventing proper cleanup and potentially
leading to resource exhaustion. Add put_device() to release the
reference in the error handling path.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: 3984114f0562 ("powerpc/warp: Platform fix for i2c change")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20251116024411.21968-1-make24@iscas.ac.cn
arch/powerpc/platforms/44x/warp.c

index a5001d32f978d72e11183739f77462b5904cdb27..6f674f86dc853ce95ec653daba8e8d57fd04120e 100644 (file)
@@ -293,6 +293,8 @@ static int pika_dtm_thread(void __iomem *fpga)
                schedule_timeout(HZ);
        }
 
+       put_device(&client->dev);
+
        return 0;
 }