public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Maurizio Lombardi <mlombard@redhat.com>
Cc: kbusch@kernel.org, hch@lst.de, linux-nvme@lists.infradead.org,
	dwagner@suse.de, hare@suse.de, jmeneghi@redhat.com,
	emilne@redhat.com, mlombard@bsdbackstore.eu
Subject: Re: [PATCH V2 1/1] nvme: add support for dynamic quirk configuration via module parameter
Date: Wed, 4 Feb 2026 10:31:15 +0100	[thread overview]
Message-ID: <20260204093115.GA30821@lst.de> (raw)
In-Reply-To: <20260202173857.759565-2-mlombard@redhat.com>

> +static int quirks_param_set(const char *value, const struct kernel_param *kp)
> +{
> +	int qcount, err, i;

qcount makes me thing of the queue count.  Given that this is the only
count, maybe just drop the q prefix?

> +	struct quirk_entry *qlist= NULL;

Missing space before the "=".

> +	char *field, *val = NULL;
> +	char *sep_ptr;
> +
> +	err = param_set_copystring(value, kp);
> +	if (err)
> +		goto exit;

Just return directly here.  Then you also don't need to initialize
val.

> +
> +	val = kstrdup(value, GFP_KERNEL);
> +	if (!val) {
> +		err = -ENOMEM;
> +		goto exit;
> +	}

Also here.

> +
> +	if (!*val)
> +		goto exit;

and then use separate out_free_val and out_free_qlist labels
to avoid the need to initialize qlist.

> +		if (nvme_parse_quirk_entry(field, &qlist[i])) {
> +			pr_err("nvme: failed to parse quirk string %s\n",
> +								value);
> +			goto exit;

The indentation is a bit odd, usualy this would be a two-tab alignment
or after the opening brace.

> +
> +	nvme_pci_quirk_count = qcount;
> +	nvme_pci_quirk_list  = qlist;
> +	kfree(val);

And once you have the out_free_val label, it can be shared with
the regular return.

Otherwise this looks good, and the parsing is much more readable
being split up a bit like this.


      reply	other threads:[~2026-02-04  9:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02 17:38 [PATCH V2 0/1] Enable/Disable NVMe quirks via module parameter Maurizio Lombardi
2026-02-02 17:38 ` [PATCH V2 1/1] nvme: add support for dynamic quirk configuration " Maurizio Lombardi
2026-02-04  9:31   ` Christoph Hellwig [this message]

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=20260204093115.GA30821@lst.de \
    --to=hch@lst.de \
    --cc=dwagner@suse.de \
    --cc=emilne@redhat.com \
    --cc=hare@suse.de \
    --cc=jmeneghi@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mlombard@bsdbackstore.eu \
    --cc=mlombard@redhat.com \
    /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