From: Marco Felsch <m.felsch@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Subject: [PATCH v2 6/7] treewide: make use of new run_command variadic
Date: Thu, 12 Feb 2026 23:02:08 +0100 [thread overview]
Message-ID: <20260212-vmaster-customers-leicageo-system1600-v2-6-f590b7d5b0e9@pengutronix.de> (raw)
In-Reply-To: <20260212-vmaster-customers-leicageo-system1600-v2-0-f590b7d5b0e9@pengutronix.de>
Since run_command accepts variadic inputs we no longer need to alloc the
cmd buffer and instead let run_command do the job for us.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
common/startup.c | 5 +----
net/ifup.c | 10 +++-------
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/common/startup.c b/common/startup.c
index 055d94fe6ab6d477c2d088108d7944974cebe587..dd643182043f13def7e06a1ea80a7f35d346c550 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -321,7 +321,6 @@ static int run_init(void)
if (!ret) {
for (i = 0; i < g.gl_pathc; i++) {
const char *path = g.gl_pathv[i];
- char *scr;
ret = stat(path, &s);
if (ret)
@@ -331,9 +330,7 @@ static int run_init(void)
continue;
pr_debug("Executing '%s'...\n", path);
- scr = basprintf("source %s", path);
- run_command(scr);
- free(scr);
+ run_command("source %s", path);
}
globfree(&g);
diff --git a/net/ifup.c b/net/ifup.c
index 0a0c94f6f2a6ba7571514504f3050076a23a893a..bd821535e8b364091ea689588a35b45d50285cf3 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -66,7 +66,7 @@ static int source_env_network(struct eth_device *edev)
};
IPaddr_t ipaddr, netmask, gateway, serverip;
unsigned char ethaddr[6];
- char *file, *cmd;
+ char *file;
const char *ethaddrstr, *modestr, *linuxdevname;
int ret, mode, ethaddr_valid = 0, i;
struct stat s;
@@ -87,12 +87,9 @@ static int source_env_network(struct eth_device *edev)
for (i = 0; i < ARRAY_SIZE(vars); i++)
unsetenv(vars[i]);
- cmd = basprintf("source /env/network/%s", edev->devname);
- ret = run_command(cmd);
- if (ret) {
- pr_err("Running '%s' failed with %d\n", cmd, ret);
+ ret = run_command("source /env/network/%s", edev->devname);
+ if (ret)
goto out;
- }
ipaddr = getenv_ip("ipaddr");
netmask = getenv_ip("netmask");
@@ -150,7 +147,6 @@ static int source_env_network(struct eth_device *edev)
out:
env_pop_context();
- free(cmd);
free(file);
return ret;
--
2.47.3
next prev parent reply other threads:[~2026-02-12 22:03 UTC|newest]
Thread overview: 8+ 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-12 22:02 ` Marco Felsch [this message]
2026-02-12 22:02 ` [PATCH v2 7/7] ARM: i.MX8MM: add Hexagon Geosystems GS05 Marco Felsch
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=20260212-vmaster-customers-leicageo-system1600-v2-6-f590b7d5b0e9@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=barebox@lists.infradead.org \
--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