Skip to content

Commit b01ddcb

Browse files
committed
usb: phytium_v2: fix uninitialized ret in gadget_start
Log: 2025-05-16T12:01:20.8409093Z drivers/usb/phytium_usb_v2/gadget.c:1563:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] 2025-05-16T12:01:20.8411014Z 1563 | if (!pdev->setup_buf) 2025-05-16T12:01:20.8411857Z | ^~~~~~~~~~~~~~~~ 2025-05-16T12:01:20.8412989Z drivers/usb/phytium_usb_v2/gadget.c:1600:9: note: uninitialized use occurs here 2025-05-16T12:01:20.8414076Z 1600 | return ret; 2025-05-16T12:01:20.8414775Z | ^~~ 2025-05-16T12:01:20.8415931Z drivers/usb/phytium_usb_v2/gadget.c:1563:2: note: remove the 'if' if its condition is always false 2025-05-16T12:01:20.8417705Z 1563 | if (!pdev->setup_buf) 2025-05-16T12:01:20.8418583Z | ^~~~~~~~~~~~~~~~~~~~~ 2025-05-16T12:01:20.8419358Z 1564 | goto free_pdev; 2025-05-16T12:01:20.8420170Z | ~~~~~~~~~~~~~~ 2025-05-16T12:01:20.8421430Z drivers/usb/phytium_usb_v2/gadget.c:1525:9: note: initialize the variable 'ret' to silence this warning 2025-05-16T12:01:20.8422666Z 1525 | int ret; 2025-05-16T12:01:20.8423346Z | ^ 2025-05-16T12:01:20.8424036Z | = 0 Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 7f1452f commit b01ddcb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/usb/phytium_usb_v2/gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ static int gadget_start(void *data)
15221522
struct phytium_device *pdev;
15231523
struct phytium_usb *phytium_usb = (struct phytium_usb *)data;
15241524
u32 max_speed;
1525-
int ret;
1525+
int ret = -ENOMEM;
15261526

15271527
if (!phytium_usb)
15281528
return 0;

0 commit comments

Comments
 (0)