Skip to content

nvme-print: fix to check init and finish functions - #3841

Open
ikegami-t wants to merge 1 commit into
linux-nvme:masterfrom
ikegami-t:json-error
Open

nvme-print: fix to check init and finish functions#3841
ikegami-t wants to merge 1 commit into
linux-nvme:masterfrom
ikegami-t:json-error

Conversation

@ikegami-t

Copy link
Copy Markdown
Contributor

Since basically nvme_print is skipped for dry-run. But some print functions not using nvme_print are not skipped. So the json_r object not created then the json print error caused.

Since basically nvme_print is skipped for dry-run.
But some print functions not using nvme_print are not skipped.
So the json_r object not created then the json print error caused.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Comment thread src/nvme-print.c
return false;

if (!nvme_args.dry_run)
return true;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change the order and also the logic slightly:

...
/* 
  * Always run init and the finish hooks to properly initialize the
  * the output plugin.
  */
if (func == ops->show_init || func == ops->show_finish)
		return true;

if (nvme_args.dry_run)
		return false;

return true;

This feels a bit more natural do read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants