summaryrefslogtreecommitdiffstats
path: root/common/ratp/ratp.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-02-24 16:01:18 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-03-01 09:39:42 +0100
commit706328c33fc8e9e680f37ee4cdac9ecbf3127f23 (patch)
tree1fab78330ace896a9c942ad5e474c316f0ec82bd /common/ratp/ratp.c
parent884eeea4082b36e8cca56f2886947d934bf40238 (diff)
downloadbarebox-706328c33fc8e9e680f37ee4cdac9ecbf3127f23.tar.gz
barebox-706328c33fc8e9e680f37ee4cdac9ecbf3127f23.tar.xz
ratp: use xstrndup() instead of a custom xmemdup_add_zero()
The console operations done via RATP expect strings, so just use xstrndup() instead of defining a custom method. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/ratp/ratp.c')
-rw-r--r--common/ratp/ratp.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/common/ratp/ratp.c b/common/ratp/ratp.c
index 1e9c65179f..fae9cec5b9 100644
--- a/common/ratp/ratp.c
+++ b/common/ratp/ratp.c
@@ -132,17 +132,6 @@ static int console_send(struct ratp *r, void *pkt, int len)
return 0;
}
-static void *xmemdup_add_zero(const void *buf, int len)
-{
- void *ret;
-
- ret = xzalloc(len + 1);
- *(uint8_t *)(ret + len) = 0;
- memcpy(ret, buf, len);
-
- return ret;
-}
-
static void ratp_queue_console_tx(struct ratp_ctx *ctx)
{
u8 buf[255];
@@ -220,7 +209,7 @@ static int ratp_bb_dispatch(struct ratp_ctx *ctx, const void *buf, int len)
if (!IS_ENABLED(CONFIG_CONSOLE_RATP) || ratp_command)
return 0;
- ratp_command = xmemdup_add_zero(&rbb->data, dlen);
+ ratp_command = xstrndup((const char *)rbb->data, dlen);
ratp_ctx = ctx;
pr_debug("got command: %s\n", ratp_command);