From f90d9589a9391ca15241b0775178634d9a50404d Mon Sep 17 00:00:00 2001 From: WangYuli Date: Sun, 24 Nov 2024 22:10:43 +0800 Subject: [PATCH] i3c: phytium: initialize variable 'ret' when !master->prescl0 Fix follow error with clang-19: drivers/i3c/master/i3c-master-phytium.c:1710:7: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] 1710 | if (!master->prescl0) | ^~~~~~~~~~~~~~~~ drivers/i3c/master/i3c-master-phytium.c:1788:9: note: uninitialized use occurs here 1788 | return ret; | ^~~ drivers/i3c/master/i3c-master-phytium.c:1710:3: note: remove the 'if' if its condition is always false 1710 | if (!master->prescl0) | ^~~~~~~~~~~~~~~~~~~~~ 1711 | goto err_disable_sysclk; | ~~~~~~~~~~~~~~~~~~~~~~~ drivers/i3c/master/i3c-master-phytium.c:1669:9: note: initialize the variable 'ret' to silence this warning 1669 | int ret, irq; | ^ | = 0 1 error generated. Signed-off-by: WangYuli --- drivers/i3c/master/i3c-master-phytium.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i3c/master/i3c-master-phytium.c b/drivers/i3c/master/i3c-master-phytium.c index 50f3f6c989951..f6b92a21c43b5 100644 --- a/drivers/i3c/master/i3c-master-phytium.c +++ b/drivers/i3c/master/i3c-master-phytium.c @@ -1666,7 +1666,8 @@ static int phytium_i3c_master_probe(struct platform_device *pdev) { struct phytium_i3c_master *master; struct resource *res; - int ret, irq; + int ret = -EINVAL; + int irq; u32 val; master = devm_kzalloc(&pdev->dev, sizeof(*master), GFP_KERNEL);