From: Jie Gan <quic_jiegan@quicinc.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: <coresight@lists.linaro.org>, <linux-arm-kernel@lists.infradead.org>
Subject: Re: [bug report] Coresight: Allocate trace ID after building the path
Date: Tue, 1 Apr 2025 09:05:00 +0800 [thread overview]
Message-ID: <bd93fcc8-b24a-4215-a5d5-aeaea022c789@quicinc.com> (raw)
In-Reply-To: <669d3cd7-6dce-48cd-a409-567ebfaa5309@stanley.mountain>
On 3/31/2025 10:14 PM, Dan Carpenter wrote:
> 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.
Thanks for reporting.
Jie
>
> 698 return;
> 699 }
> 700 }
> 701 }
>
> regards,
> dan carpenter
prev parent reply other threads:[~2025-04-01 1:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 14:14 [bug report] Coresight: Allocate trace ID after building the path Dan Carpenter
2025-04-01 1:05 ` Jie Gan [this message]
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=bd93fcc8-b24a-4215-a5d5-aeaea022c789@quicinc.com \
--to=quic_jiegan@quicinc.com \
--cc=coresight@lists.linaro.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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