Skip to content

Commit

Permalink
i3c: phytium: initialize variable 'ret' when !master->prescl0
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Avenger-285714 committed Nov 25, 2024
1 parent 7c3df73 commit d90ba54
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/i3c/master/i3c-master-phytium.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d90ba54

Please sign in to comment.