Skip to content

Commit 088b1ca

Browse files
author
Andi Shyti
committed
i2c: k1: Initialize variable before use
Commit 95a8ca2 ("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 <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Cc: Troy Mitchell <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andi Shyti <[email protected]>
1 parent 5ea5584 commit 088b1ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/i2c/busses/i2c-k1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ static int spacemit_i2c_probe(struct platform_device *pdev)
514514
if (!i2c)
515515
return -ENOMEM;
516516

517-
of_property_read_u32(of_node, "clock-frequency", &i2c->clock_freq);
517+
ret = of_property_read_u32(of_node, "clock-frequency", &i2c->clock_freq);
518518
if (ret && ret != -EINVAL)
519519
dev_warn(dev, "failed to read clock-frequency property: %d\n", ret);
520520

0 commit comments

Comments
 (0)