Netdev List
 help / color / mirror / Atom feed
From: Johannes Eigner <johannes.eigner@a-eberle.de>
To: netdev@vger.kernel.org
Cc: Michal Kubecek <mkubecek@suse.cz>,
	 Danielle Ratson <danieller@nvidia.com>,
	 Stephan Wurm <stephan.wurm@a-eberle.de>,
	 Johannes Eigner <johannes.eigner@a-eberle.de>
Subject: [PATCH ethtool 1/2] sfpid: Fix JSON output of SFP diagnostics
Date: Tue, 21 Oct 2025 16:00:12 +0200	[thread overview]
Message-ID: <20251021-fix-module-info-json-v1-1-01d61b1973f6@a-eberle.de> (raw)
In-Reply-To: <20251021-fix-module-info-json-v1-0-01d61b1973f6@a-eberle.de>

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]

Close and delete JSON object only after output of SFP diagnostics so
that it is also JSON formatted. If the JSON object is deleted too early,
some of the output will not be JSON formatted, resulting in mixed output
formats.

Signed-off-by: Johannes Eigner <johannes.eigner@a-eberle.de>
---
 sfpid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sfpid.c b/sfpid.c
index 62acb4f..5216ce3 100644
--- a/sfpid.c
+++ b/sfpid.c
@@ -520,8 +520,6 @@ int sff8079_show_all_nl(struct cmd_context *ctx)
 	new_json_obj(ctx->json);
 	open_json_object(NULL);
 	sff8079_show_all_common(buf);
-	close_json_object();
-	delete_json_obj();
 
 	/* Finish if A2h page is not present */
 	if (!(buf[92] & (1 << 6)))
@@ -537,6 +535,8 @@ int sff8079_show_all_nl(struct cmd_context *ctx)
 
 	sff8472_show_all(buf);
 out:
+	close_json_object();
+	delete_json_obj();
 	free(buf);
 
 	return ret;

-- 
2.43.0


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 4153 bytes --]

  reply	other threads:[~2025-10-21 14:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 14:00 [PATCH ethtool 0/2] fix module info JSON output Johannes Eigner
2025-10-21 14:00 ` Johannes Eigner [this message]
2025-10-22 12:55   ` [PATCH ethtool 1/2] sfpid: Fix JSON output of SFP diagnostics Danielle Ratson
2025-10-22 14:52     ` Johannes Eigner
2025-10-21 14:00 ` [PATCH ethtool 2/2] sff-common: Fix naming of JSON keys for thresholds Johannes Eigner
2025-10-22 13:32   ` Andrew Lunn
2025-10-22 14:59     ` Johannes Eigner
2025-10-22 15:34       ` Andrew Lunn
2025-10-23 10:02         ` Johannes Eigner
2025-10-23 13:14           ` Andrew Lunn

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=20251021-fix-module-info-json-v1-1-01d61b1973f6@a-eberle.de \
    --to=johannes.eigner@a-eberle.de \
    --cc=danieller@nvidia.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=stephan.wurm@a-eberle.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