Subject: Coverity: tcpm_handle_alert(): Error handling issues

From: coverity-bot <[email-masked]>
Date: Tue, 8 Jun 2021 11:02:44 -0700

Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20210608 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Fri Jun 4 13:24:16 2021 +0200
    063933f47a7a ("usb: typec: tcpm: Properly handle Alert and Status Messages")

Coverity reported the following:

*** CID 1505153:  Error handling issues  (CHECKED_RETURN)
/drivers/usb/typec/tcpm/tcpm.c: 2227 in tcpm_handle_alert()
2221     	}
2222
2223     	/* Just handling non-battery alerts for now */
2224     	if (!(type & USB_PD_ADO_TYPE_BATT_STATUS_CHANGE)) {
2225     		if (port->pwr_role == TYPEC_SOURCE) {
2226     			port->upcoming_state = GET_STATUS_SEND;
vvv     CID 1505153:  Error handling issues  (CHECKED_RETURN)
vvv     Calling "tcpm_ams_start" without checking return value (as is done elsewhere 15 out of 17 times).
2227     			tcpm_ams_start(port, GETTING_SOURCE_SINK_STATUS);
2228     		} else {
2229     			/*
2230     			 * Do not check SinkTxOk here in case the Source doesn't set its Rp to
2231     			 * SinkTxOk in time.
2232     			 */

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <[email-masked]>
Addresses-Coverity-ID: 1505153 ("Error handling issues")
Fixes: 063933f47a7a ("usb: typec: tcpm: Properly handle Alert and Status Messages")

Thanks for your attention!

-- 
Coverity-bot