usb: typec: ucsi: huawei_gaokun: add error checking
Pengyu Luo
maintainerPATCH 1/1 usb: typec: ucsi: huawei_gaokun: add error checking
'cci' may be uninitialized, adding error checking to fix it.
Reported-by Dan Carpenter <[email protected]>
Fixes 00327d7f2c8c ("usb: typec: ucsi: add Huawei Matebook E Go ucsi driver")
Signed-off-by Pengyu Luo <[email protected]>
--- drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c +5 -1
@@ -359,6 +359,7 @@ static int gaokun_ucsi_notify(struct notifier_block *nb, unsigned long action, void *data) { u32 cci; +int ret; struct gaokun_ucsi *uec = container_of(nb, struct gaokun_ucsi, nb);switch (action) {
@@ -368,7 +369,10 @@ static int gaokun_ucsi_notify(struct notifier_block *nb,return NOTIFY_OK ;case EC_EVENT_UCSI : -gaokun_ucsi_read_cci (uec->ucsi, &cci); + ret =gaokun_ucsi_read_cci (uec->ucsi, &cci); +if (ret) +return NOTIFY_DONE ; +ucsi_notify_common (uec->ucsi, cci);if (UCSI_CCI_CONNECTOR (cci))gaokun_ucsi_handle_no_usb_event (uec,UCSI_CCI_CONNECTOR (cci) -1 );
Signature · 1 line
2.49.0
Quoted 6 lines · Pengyu Luo
'cci' may be uninitialized, adding error checking to fix it.
Reported-by Dan Carpenter <[email protected]>Fixes 00327d7f2c8c ("usb: typec: ucsi: add Huawei Matebook E Go ucsi driver")Signed-off-by Pengyu Luo <[email protected]>
Reviewed-by Heikki Krogerus <[email protected]>
Quoted 30 lines
--- drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c +5
-1@@ -359,6 +359,7 @@ static int gaokun_ucsi_notify(struct notifier_block *nb, unsigned long action, void *data) { u32 cci; +int ret; struct gaokun_ucsi *uec = container_of(nb, struct gaokun_ucsi, nb);switch (action) {@@ -368,7 +369,10 @@ static int gaokun_ucsi_notify(struct notifier_block *nb,return NOTIFY_OK ;case EC_EVENT_UCSI : -gaokun_ucsi_read_cci (uec->ucsi, &cci); + ret =gaokun_ucsi_read_cci (uec->ucsi, &cci); +if (ret) +return NOTIFY_DONE ; +ucsi_notify_common (uec->ucsi, cci);if (UCSI_CCI_CONNECTOR (cci))gaokun_ucsi_handle_no_usb_event (uec,UCSI_CCI_CONNECTOR (cci) -1 );Signature · 1 line
2.49.0
Signature · 1 line
heikki