mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] commands: delpart: return success when no error occurred
@ 2026-01-14 10:13 Ahmad Fatoum
  2026-01-14 10:13 ` [PATCH 2/2] lib: cmdlinepart: support RO both in lower and upper case Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-01-14 10:13 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Since the introduction of cdevs, this command returns 1 unconditionally.
Fix that up to return 0 on success and a more descriptive code
otherwise.

Fixes: a2b7cd183bad ("introduce cdev")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/partition.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/partition.c b/commands/partition.c
index 7dd2fa629b6f..9444edac9e59 100644
--- a/commands/partition.c
+++ b/commands/partition.c
@@ -91,11 +91,11 @@ static int do_delpart(int argc, char *argv[])
 		err = devfs_del_partition(kbasename(argv[i]));
 		if (err) {
 			printf("cannot delete %s: %pe\n", argv[i], ERR_PTR(err));
-			break;
+			return err;
 		}
 	}
 
-	return 1;
+	return 0;
 }
 
 BAREBOX_CMD_HELP_START(delpart)
-- 
2.47.3




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] lib: cmdlinepart: support RO both in lower and upper case
  2026-01-14 10:13 [PATCH 1/2] commands: delpart: return success when no error occurred Ahmad Fatoum
@ 2026-01-14 10:13 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2026-01-14 10:13 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The help text of the addpart command lists RO as being uppercase,
but the code expects it to be lower-case.

Resolve this by supporting either case.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 lib/cmdlinepart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/cmdlinepart.c b/lib/cmdlinepart.c
index 3e8c415c7ea6..16fa4605d822 100644
--- a/lib/cmdlinepart.c
+++ b/lib/cmdlinepart.c
@@ -74,7 +74,7 @@ int cmdlinepart_do_parse_one(const char *devname, const char *partstr,
 
 	partstr = end;
 
-	if (*partstr == 'r' && *(partstr + 1) == 'o') {
+	if (!strncasecmp(partstr, "ro", 2)) {
 		flags |= DEVFS_PARTITION_READONLY;
 		end = (char *)(partstr + 2);
 	}
-- 
2.47.3




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-14 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-14 10:13 [PATCH 1/2] commands: delpart: return success when no error occurred Ahmad Fatoum
2026-01-14 10:13 ` [PATCH 2/2] lib: cmdlinepart: support RO both in lower and upper case Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox