From: Andi Shyti Date: Thu, 20 Mar 2025 11:35:21 +0000 (+0100) Subject: i2c: k1: Initialize variable before use X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=088b1ca970ba6cac141f684b7592ce56bd25e7ea;p=users%2Fjedix%2Flinux-maple.git i2c: k1: Initialize variable before use Commit 95a8ca229032 ("i2c: spacemit: add support for SpacemiT K1 SoC") introduced a check in the probe function to warn the user if the DTS has incorrect frequency settings. In such cases, the driver falls back to default values. However, the return value of of_property_read_u32() was not stored, making the check ineffective. Fix this by storing the return value in 'ret' and evaluating it properly. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202503200928.eBWfwnHG-lkp@intel.com/ Cc: Troy Mitchell Link: https://lore.kernel.org/r/20250320113521.3966762-1-andi.shyti@kernel.org Signed-off-by: Andi Shyti --- diff --git a/drivers/i2c/busses/i2c-k1.c b/drivers/i2c/busses/i2c-k1.c index 0d8763b852db9..5965b4cf6220e 100644 --- a/drivers/i2c/busses/i2c-k1.c +++ b/drivers/i2c/busses/i2c-k1.c @@ -514,7 +514,7 @@ static int spacemit_i2c_probe(struct platform_device *pdev) if (!i2c) return -ENOMEM; - of_property_read_u32(of_node, "clock-frequency", &i2c->clock_freq); + ret = of_property_read_u32(of_node, "clock-frequency", &i2c->clock_freq); if (ret && ret != -EINVAL) dev_warn(dev, "failed to read clock-frequency property: %d\n", ret);