[RESEND PATCH v2 3/4] nvme: add debugfs helpers for NVMe drivers

Maurizio Lombardi mlombard at arkamax.eu
Fri Jul 31 01:14:26 PDT 2026


On Fri Jul 31, 2026 at 9:39 AM CEST, Nilay Shroff wrote:
> +static int nvme_debugfs_open(struct inode *inode, struct file *file)
> +{
> +	void *data = inode->i_private;
> +	struct nvme_debugfs_attr *attr = debugfs_get_aux(file);
> +	struct nvme_debugfs_ctx *ctx;
> +	struct seq_file *m;
> +	int ret;
> +
> +	if (attr->get && !attr->get(data))
> +		return -ENODEV;
> +
> +	ctx = kzalloc_obj(*ctx);
> +	if (WARN_ON_ONCE(!ctx)) {
> +		ret = -ENOMEM;
> +		goto out;
> +	}

Just a nit, I don't think that raising a warning just because
kzalloc() returned NULL is a good idea as failures can naturally
occur under OOM conditions and aren't bugs.

Maurizio



More information about the Linux-nvme mailing list