cmd: sf/nand: Print and return failure when 0 length is passed
authorAshok Reddy Soma <ashok.reddy.soma@amd.com>
Tue, 16 May 2023 11:52:36 +0000 (05:52 -0600)
committerMichal Simek <michal.simek@amd.com>
Mon, 12 Jun 2023 11:24:31 +0000 (13:24 +0200)
commitf5aa35c932a073489b3996c26435d7e16a1d6428
tree05aaf35bd8e07187deadbf3287798a19db7865ff
parentb4501aa0283d664dfa9d93ed56a8d1ce97f95b14
cmd: sf/nand: Print and return failure when 0 length is passed

For sf commands, when '0' length is passed for erase, update, write or
read, there might be undesired results. Ideally '0' length means nothing to
do.

So print 'ERROR: Invalid size 0' and return cmd failure when length '0' is
passed to sf commands. Same thing applies for nand commands also.

Example:

ZynqMP> sf erase 0 0
ERROR: Invalid size 0
ZynqMP> sf write 10000 0 0
ERROR: Invalid size 0
ZynqMP> sf read 10000 0 0
ERROR: Invalid size 0
ZynqMP> sf update 1000 10000 0
ERROR: Invalid size 0
ZynqMP>

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230516115236.22458-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
cmd/legacy-mtd-utils.c
cmd/sf.c