Linux USB
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Sven Peter <sven@kernel.org>
Cc: linux-usb@vger.kernel.org
Subject: [bug report] usb: typec: tipd: Read USB4, Thunderbolt and DisplayPort status for cd321x
Date: Thu, 18 Sep 2025 12:51:34 +0300	[thread overview]
Message-ID: <aMvWJo3IkClmFoAA@stanley.mountain> (raw)

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

                 reply	other threads:[~2025-09-18  9:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aMvWJo3IkClmFoAA@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sven@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox