power: power_i2c: ret is uninitialised if not DM_I2C
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 7 Aug 2025 14:28:58 +0000 (15:28 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 29 Aug 2025 22:44:46 +0000 (16:44 -0600)
commitaa136393c8fd448e903e3fd3297efb13e54c42d7
treeef7415177079cdadebdc82fc4ae6cd4c3c14879b
parent446b7b8f2d9b5b9bcd473c91f1e45cbb77be6c5f
power: power_i2c: ret is uninitialised if not DM_I2C

In pmic_reg_read ret is only assigned to inside #if
CONFIG_IS_ENABLED(DM_I2C) so move the test and return ret inside as well
and also guard the declaration of ret with CONFIG_IS_ENABLED(DM_I2C) to
prevent a warning about an unused variable.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
drivers/power/power_i2c.c