On Mon, Sep 14, 2026 at 07:54:18PM +0800, Qianqiang Liu wrote: > Currently, the 'nand dump' command requires a raw hex offset. When > inspecting partition headers or magic numbers, users must manually > look up the physical offset via 'mtdparts' first. Furthermore, the > command's suffix parsing (.oob, .ecc) relies on exhaustive strcmp() > permutations, which is fragile and scales poorly when adding new flags. > > This patch introduces the '.part' suffix (e.g., 'nand dump.part <part>'), > leveraging mtd_arg_off_size() to resolve the partition name to its > physical offset to dump its first page. > > Additionally, the suffix parsing is refactored to use strstr(). This > cleanly eliminates the hardcoded strcmp() combinations and inherently > supports arbitrary ordering of suffixes (e.g., 'dump.part.oob', > 'dump.ecc.part'). > > Signed-off-by: Qianqiang Liu <[email protected]>
Good idea, however, from scripts/checkpatch.pl: CHECK: Comparison to NULL could be written "strstr" #180: FILE: cmd/nand.c:708: + only_oob = (strstr(cmd, ".oob") != NULL); CHECK: Comparison to NULL could be written "strstr" #181: FILE: cmd/nand.c:709: + ecc = (strstr(cmd, ".ecc") != NULL); CHECK: Comparison to NULL could be written "strstr" #182: FILE: cmd/nand.c:710: + part = (strstr(cmd, ".part") != NULL); total: 0 errors, 0 warnings, 3 checks, 38 lines checked Please fix, thanks. -- Tom
signature.asc
Description: PGP signature
