From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
Marco Felsch <m.felsch@pengutronix.de>
Cc: BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH v2 5/7] commands: make run_command variadic
Date: Mon, 23 Feb 2026 12:05:10 +0100 [thread overview]
Message-ID: <2f242d61-816b-4487-8551-d48e65b151c2@pengutronix.de> (raw)
In-Reply-To: <aZwz7rBADSdrEaIs@pengutronix.de>
On 2/23/26 12:03 PM, Sascha Hauer wrote:
> On Thu, Feb 12, 2026 at 11:02:07PM +0100, Marco Felsch wrote:
>> This prepares run_command() to receive a format string and variadic
>> arguments which can become quite handy for board code. It also ensures
>> a proper cleanup for the command string and generalizes the error
>> message printing.
>>
>> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>> ---
>> common/hush.c | 23 ++++++++++++++++++++++-
>> common/parser.c | 24 +++++++++++++++++++++++-
>> include/command.h | 4 ++--
>> 3 files changed, 47 insertions(+), 4 deletions(-)
>>
>> diff --git a/common/hush.c b/common/hush.c
>> index 2e0cc4229d3575dcf045f68ef8db3e943c41eedb..b46a42cc90c863376bb819755afc83271120200f 100644
>> --- a/common/hush.c
>> +++ b/common/hush.c
>> @@ -1922,7 +1922,7 @@ static char * make_string(char ** inp)
>> return str;
>> }
>>
>> -int run_command(const char *cmd)
>> +static int __run_command(const char *cmd)
>> {
>> struct p_context ctx = {};
>> int ret;
>> @@ -1938,6 +1938,27 @@ int run_command(const char *cmd)
>> return ret;
>> }
>>
>> +int run_command(const char *fmt, ...)
>> +{
>> + va_list vargs;
>> + char *cmd;
>> + int error;
>> +
>> + va_start(vargs, fmt);
>> + cmd = xvasprintf(fmt, vargs);
>> + va_end(vargs);
>> +
>> + error = __run_command(cmd);
>> + if (error) {
>> + error_msg("Failed to run CMD: '%s' with %d\n", cmd, error);
>> + free(cmd);
>> + return error;
>> + }
>
> Dropped this error printing while applying. There was no error printing
> before this patch and also some commands might intentionally silently
> fail, so error printing should be done in the caller.
Good catch. gpio_get_value comes to mind where this would be rather
confusing.
Cheers,
Ahmad
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2026-02-23 11:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 22:02 [PATCH v2 0/7] Hexagon Geosystems GS05 Board Support Marco Felsch
2026-02-12 22:02 ` [PATCH v2 1/7] serdev: add proper error cleanup to serdev_device_open() Marco Felsch
2026-02-12 22:02 ` [PATCH v2 2/7] serdev: add serdev_device_close Marco Felsch
2026-02-12 22:02 ` [PATCH v2 3/7] mfd: Add Hexagon EFI driver Marco Felsch
2026-02-12 22:02 ` [PATCH v2 4/7] watchdog: Add Hexagon EFI watchdog driver Marco Felsch
2026-02-12 22:02 ` [PATCH v2 5/7] commands: make run_command variadic Marco Felsch
2026-02-23 11:03 ` Sascha Hauer
2026-02-23 11:05 ` Ahmad Fatoum [this message]
2026-02-23 11:13 ` Marco Felsch
2026-02-12 22:02 ` [PATCH v2 6/7] treewide: make use of new " Marco Felsch
2026-02-12 22:02 ` [PATCH v2 7/7] ARM: i.MX8MM: add Hexagon Geosystems GS05 Marco Felsch
2026-02-23 11:01 ` [PATCH v2 0/7] Hexagon Geosystems GS05 Board Support Sascha Hauer
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=2f242d61-816b-4487-8551-d48e65b151c2@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=m.felsch@pengutronix.de \
--cc=s.hauer@pengutronix.de \
/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