Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: ucsi: huawei_gaokun: add error checking

'cci' may be uninitialized, adding error checking to fix it.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/Z_44zoTyLLdXNkKT@stanley.mountain
Fixes: 00327d7f2c8c ("usb: typec: ucsi: add Huawei Matebook E Go ucsi driver")
Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20250415172006.126740-1-mitltlatltl@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Pengyu Luo and committed by
Greg Kroah-Hartman
e6f9fd8e db476ffa

+5 -1
+5 -1
drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c
··· 359 359 unsigned long action, void *data) 360 360 { 361 361 u32 cci; 362 + int ret; 362 363 struct gaokun_ucsi *uec = container_of(nb, struct gaokun_ucsi, nb); 363 364 364 365 switch (action) { ··· 369 368 return NOTIFY_OK; 370 369 371 370 case EC_EVENT_UCSI: 372 - gaokun_ucsi_read_cci(uec->ucsi, &cci); 371 + ret = gaokun_ucsi_read_cci(uec->ucsi, &cci); 372 + if (ret) 373 + return NOTIFY_DONE; 374 + 373 375 ucsi_notify_common(uec->ucsi, cci); 374 376 if (UCSI_CCI_CONNECTOR(cci)) 375 377 gaokun_ucsi_handle_no_usb_event(uec, UCSI_CCI_CONNECTOR(cci) - 1);