From: Jiri Pirko <[email protected]>
The binary is printed out into json as an array of byte values.
Add missing (removed) start and end array json calls.
Fixes: f359942a25d3 ("devlink: Remove enclosing array brackets binary print
with json format")
Signed-off-by: Jiri Pirko <[email protected]>
---
devlink/devlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 51aba6e200cd..8fc1f3b8b35a 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1930,6 +1930,8 @@ static void pr_out_binary_value(struct dl *dl, uint8_t
*data, uint32_t len)
{
int i = 0;
+ if (dl->json_output)
+ jsonw_start_array(dl->jw);
while (i < len) {
if (dl->json_output)
jsonw_printf(dl->jw, "%d", data[i]);
@@ -1941,6 +1943,8 @@ static void pr_out_binary_value(struct dl *dl, uint8_t
*data, uint32_t len)
}
if (!dl->json_output && !is_binary_eol(i))
__pr_out_newline();
+ if (dl->json_output)
+ jsonw_end_array(dl->jw);
}
static void pr_out_str_value(struct dl *dl, const char *value)
--
2.21.0