usb: typec: tipd: Read USB4, Thunderbolt and DisplayPort status for cd321x
Hello Sven Peter,
Commit 0b31c978935f ("usb: typec: tipd: Read USB4, Thunderbolt and DisplayPort status for cd321x") from Sep 14, 2025 (linux-next), leads to the following Smatch static checker warning:
drivers/usb/typec/tipd/core.c:580 cd321x_read_data_status() warn: bool is not less than zero.
drivers/usb/typec/tipd/core.c
574 static bool cd321x_read_data_status(struct tps6598x *tps)
575 {
576 struct cd321x *cd321x = container_of(tps, struct cd321x, tps);
577 int ret;
578
579 ret = tps6598x_read_data_status(tps);
--> 580 if (ret < 0)
581 return false;The tps6598x_read_data_status() function returns true/false.
582
583 if (tps->data_status & TPS_DATA_STATUS_DP_CONNECTION) {
584 ret = tps6598x_block_read(tps, TPS_REG_DP_SID_STATUS,
585 &cd321x->dp_sid_status, sizeof(cd321x->dp_sid_status));
586 if (ret)
587 dev_err(tps->dev, "Failed to read DP SID Status: %d\n",
588 ret);
589 }
590
591 if (tps->data_status & TPS_DATA_STATUS_TBT_CONNECTION) {
592 ret = tps6598x_block_read(tps, TPS_REG_INTEL_VID_STATUS,
593 &cd321x->intel_vid_status, sizeof(cd321x->intel_vid_status));
594 if (ret)
595 dev_err(tps->dev, "Failed to read Intel VID Status: %d\n", ret);
596 }
597
598 if (tps->data_status & CD321X_DATA_STATUS_USB4_CONNECTION) {
599 ret = tps6598x_block_read(tps, TPS_REG_USB4_STATUS,
600 &cd321x->usb4_status, sizeof(cd321x->usb4_status));
601 if (ret)
602 dev_err(tps->dev,
603 "Failed to read USB4 Status: %d\n", ret);
604 }
605
606 return true;Should this be if (err) return false?
607 }
regards,
dan carpenter