From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: Sneh Mankad <sneh.mankad@oss.qualcomm.com>,
andersson@kernel.org, konradybcio@kernel.org,
linux-arm-msm@vger.kernel.org
Cc: alok.a.tiwarilinux@gmail.com
Subject: Re: [PATCH] soc: qcom: cmd-db: fix minor version decoding in debugfs output
Date: Mon, 30 Mar 2026 11:33:13 +0530 [thread overview]
Message-ID: <bdaccf73-d7aa-489a-b0fe-94ea2d1d2a83@oracle.com> (raw)
In-Reply-To: <eed2185e-1754-4e5a-8a19-36b9f968c03a@oss.qualcomm.com>
On 3/30/2026 11:05 AM, Sneh Mankad wrote:
>> cmd-db encodes the version as major in the high byte and minor in the low
>> byte. cmd_db_debugfs_dump() prints the full 16 bit value as the minor
>> version, resulting in incorrect output.
>>
>> Extract minor from the low byte using (version & 0xff).
>>
>> Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
> There should be a "fixes:" tag added since this is a fix.
>> ---
>> drivers/soc/qcom/cmd-db.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
>> index 84a75d8c4b70..eed7013c7676 100644
>> --- a/drivers/soc/qcom/cmd-db.c
>> +++ b/drivers/soc/qcom/cmd-db.c
>> @@ -301,7 +301,7 @@ static int cmd_db_debugfs_dump(struct seq_file
>> *seq, void *p)
>> version = le16_to_cpu(rsc->version);
>> major = version >> 8;
>> - minor = version;
>> + minor = version & 0xff;
>
> Minor is already a u8 type, so assigning a u16 type version to u8 type
> will automatically truncate the higher 8 bits.
>
> Its the same reason why version is right shifted by 8 before being
> assigned to major variable.
>
> I do not think there would be any difference in output with or without
> the change, do you have any example?
Thanks for pointing this out.
You are right that if minor is of type u8, assigning a u16 value will
implicitly truncate the upper 8 bits.
However, the intention of the change is to explicitly extract the minor
version from the lower byte, since the encoding defines the version as
major in the high byte and minor in the low byte.
Using version & 0xff makes the extraction explicit and consistent with
how major is derived using version >> 8. It improves readability and
avoids relying on implicit truncation.
Since this change does not alter functionality and is mainly for clarity
and consistency I believe a Fixes: tag may not be appropriate.
I can also drop “fix” from the subject to avoid confusion.
Thanks,
Alok
next prev parent reply other threads:[~2026-03-30 6:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-29 19:11 [PATCH] soc: qcom: cmd-db: fix minor version decoding in debugfs output Alok Tiwari
2026-03-30 5:35 ` Sneh Mankad
2026-03-30 6:03 ` ALOK TIWARI [this message]
2026-03-30 11:12 ` Dmitry Baryshkov
2026-03-30 13:18 ` Bjorn Andersson
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=bdaccf73-d7aa-489a-b0fe-94ea2d1d2a83@oracle.com \
--to=alok.a.tiwari@oracle.com \
--cc=alok.a.tiwarilinux@gmail.com \
--cc=andersson@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=sneh.mankad@oss.qualcomm.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