From: Dan Carpenter <dan.carpenter@linaro.org>
To: Jie Gan <quic_jiegan@quicinc.com>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org
Subject: [bug report] Coresight: Allocate trace ID after building the path
Date: Mon, 31 Mar 2025 17:14:30 +0300 [thread overview]
Message-ID: <669d3cd7-6dce-48cd-a409-567ebfaa5309@stanley.mountain> (raw)
Hello Jie Gan,
Commit d87d76d823d1 ("Coresight: Allocate trace ID after building the
path") from Mar 3, 2025 (linux-next), leads to the following Smatch
static checker warning:
drivers/hwtracing/coresight/coresight-core.c:697 coresight_path_assign_trace_id()
warn: assigning signed to unsigned: 'path->trace_id = trace_id' 's32min-(-1),1-s32max'
drivers/hwtracing/coresight/coresight-core.c
681 void coresight_path_assign_trace_id(struct coresight_path *path,
682 enum cs_mode mode)
683 {
684 struct coresight_device *sink = coresight_get_sink(path);
685 struct coresight_node *nd;
686 int trace_id;
687
688 list_for_each_entry(nd, &path->path_list, link) {
689 /* Assign a trace ID to the path for the first device that wants to do it */
690 trace_id = coresight_get_trace_id(nd->csdev, mode, sink);
691
692 /*
693 * 0 in this context is that it didn't want to assign so keep searching.
694 * Non 0 is either success or fail.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
True enough... coresight_etm_get_trace_id() returns -EINVAL on error.
695 */
696 if (trace_id != 0) {
--> 697 path->trace_id = trace_id;
^^^^^^^^^^^^^^^^^^^^^^^^^
It doesn't make sense to store -EINVAL in a u8.
698 return;
699 }
700 }
701 }
regards,
dan carpenter
next reply other threads:[~2025-03-31 14:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 14:14 Dan Carpenter [this message]
2025-04-01 1:05 ` [bug report] Coresight: Allocate trace ID after building the path Jie Gan
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=669d3cd7-6dce-48cd-a409-567ebfaa5309@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=coresight@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=quic_jiegan@quicinc.com \
/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