]> www.infradead.org Git - users/hch/misc.git/commit
i3c: master: svc: Fix i3c_master_get_free_addr return check
authorStanley Chu <yschu@nuvoton.com>
Mon, 10 Mar 2025 02:33:04 +0000 (10:33 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 17 Mar 2025 22:46:06 +0000 (23:46 +0100)
commitd6cb667b8e15bac47f19aec4bd81f3916b2ca9f5
treeb8dccad0b5530a2e5a92f3b8dc690c450a6fcdc8
parent2a785307e41b5c621228e3a7ec3949af546a3e69
i3c: master: svc: Fix i3c_master_get_free_addr return check

The return value of i3c_master_get_free_addr is assigned to a variable
with wrong type, so it can't be negative. Use a signed integer for the
return value. If the value is negative, break the process and propagate
the error code.

This commit also fixes the uninitialized symbol 'dyn_addr', reported
by Smatch static checker.

Fixes: 4008a74e0f9b ("i3c: master: svc: Fix npcm845 FIFO empty issue")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/029e5ac0-5444-4a8e-bca4-cec55950d2b9@stanley.mountain/
Signed-off-by: Stanley Chu <yschu@nuvoton.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20250310023304.2335792-1-yschu@nuvoton.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/svc-i3c-master.c