nvdimm/btt: fix sequence endian in btt_log_read error print
PATCH v2 1/1 nvdimm/btt: fix sequence endian in btt_log_read error print
The error reporting in btt_log_read() prints sequence numbers out from the log which are stored in little endian without any endian conversion. Make sure these are passed throuhg endian convesion before going to the kernel console so the user sees the correct sequence number and to avoid any warnings from sparse due to endian conversion.
Fix the following (prototype) sparse warnings:drivers/nvdimm/btt.c:342:17: warning: incorrect type in argument 5 (different base types)drivers/nvdimm/btt.c:342:17: expected intdrivers/nvdimm/btt.c:342:17: got restricted __le32 [usertype] seqdrivers/nvdimm/btt.c:342:17: warning: incorrect type in argument 6 (different base types)drivers/nvdimm/btt.c:342:17: expected intdrivers/nvdimm/btt.c:342:17: got restricted __le32 [usertype] seq
---
v2: reworded commnit messae
--- drivers/nvdimm/btt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvdimm/btt.c +3 -2
@@ -341,8 +341,9 @@ static int btt_log_read(struct arena_info *arena, u32 lane,if (old_ent <0 || old_ent >1 ) {dev_err (to_dev (arena),"log corruption (%d): lane %d seq [%d, %d]\n" , - old_ent, lane, log.ent[arena->log_index[0 ]].seq, - log.ent[arena->log_index[1 ]].seq); + old_ent, lane, +le32_to_cpu (log.ent[arena->log_index[0 ]].seq), +le32_to_cpu (log.ent[arena->log_index[1 ]].seq));/* TODO set error state? */ return -EIO ; }
Signature · 1 line
2.37.2.352.g3c44437643
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] The patch open-codes the endianness conversion of the log sequence numbers instead of utilizing the…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The patch open-codes the endianness conversion of the log sequence numbers instead of utilizing the existing helper function log_seq().
- [Low] There are multiple spelling errors in the commit message.
--
commit 41767fa21db59b2ed77d8052ff41a18c93ebf763
Author: Ben Dooks <[email protected]>
nvdimm/btt: fix sequence endian in btt_log_read error print
This commit fixes endianness warnings in btt_log_read() by converting the log sequence numbers to CPU endianness before printing them. It ensures the correct sequence number is displayed and resolves sparse warnings.
Quoted 3 lines
The error reporting in
btt_log_read()prints sequence numbers out from the log which are stored in little endian without any endian conversion. Make sure these are passed throuhg endian convesion
[Severity: Low]
This isn't a bug, but there are typos ("throuhg" and "convesion") in the commit message.
drivers/nvdimm/btt.c static int btt_log_read(struct arena_info *arena, u32 lane, · line 346
Quoted 12 lines
drivers/nvdimm/btt.c +3
-2@@ -341,8 +341,9 @@ static int btt_log_read(struct arena_info *arena, u32 lane,if (old_ent <0 || old_ent >1 ) {dev_err (to_dev (arena),"log corruption (%d): lane %d seq [%d, %d]\n" , - old_ent, lane, log.ent[arena->log_index[0 ]].seq, - log.ent[arena->log_index[1 ]].seq); + old_ent, lane, +le32_to_cpu (log.ent[arena->log_index[0 ]].seq), +le32_to_cpu (log.ent[arena->log_index[1 ]].seq));
[Severity: Low]
Would it be better to use the existing log_seq() helper function here instead of open-coding the le32_to_cpu() conversion?
For example:
log_seq(&log, arena->log_index[0]),
log_seq(&log, arena->log_index[1]));Quoted 3 lines
drivers/nvdimm/btt.c +0
-0/* TODO set error state? */ return -EIO ; }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Alison Schofield
maintainerQuoted 7 lines · Ben Dooks
The error reporting in
btt_log_read()prints sequence numbers out from the log which are stored in little endian without any endian conversion. Make sure these are passed throuhg endian convesion before going to the kernel console so the user sees the correct sequence number and to avoid any warnings from sparse due to endian conversion.
Quoted 8 lines
Fix the following (prototype) sparse warnings:
drivers/nvdimm/btt.c:342:17: warning: incorrect type in argument 5 (different base types)drivers/nvdimm/btt.c:342:17: expected intdrivers/nvdimm/btt.c:342:17: got restricted__le32[usertype] seqdrivers/nvdimm/btt.c:342:17: warning: incorrect type in argument 6 (different base types)drivers/nvdimm/btt.c:342:17: expected intdrivers/nvdimm/btt.c:342:17: got restricted__le32[usertype] seq
Hi Ben,
I'll wait on a v3 of this one that addresses the Sashiko review feedback. Thanks!
-- Alison
Quoted 26 lines
Signed-off-by Ben Dooks <[email protected]>---
v2: reworded commnit messae--- drivers/nvdimm/btt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/nvdimm/btt.c +3
-2@@ -341,8 +341,9 @@ static int btt_log_read(struct arena_info *arena, u32 lane,if (old_ent <0 || old_ent >1 ) {dev_err (to_dev (arena),"log corruption (%d): lane %d seq [%d, %d]\n" , - old_ent, lane, log.ent[arena->log_index[0 ]].seq, - log.ent[arena->log_index[1 ]].seq); + old_ent, lane, +le32_to_cpu (log.ent[arena->log_index[0 ]].seq), +le32_to_cpu (log.ent[arena->log_index[1 ]].seq));/* TODO set error state? */ return -EIO ; }Signature · 1 line
2.37.2.352.g3c44437643