[PATCH 7/9] nvme: assign known effects at controller initialization time
Keith Busch
kbusch at kernel.org
Wed Dec 14 08:34:17 PST 2022
On Wed, Dec 14, 2022 at 05:13:45PM +0100, Christoph Hellwig wrote:
>
> +static int nvme_init_effects(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
> +{
> + int ret;
> +
> + if (id->lpa & NVME_CTRL_LPA_CMD_EFFECTS_LOG) {
> + ret = nvme_get_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects);
> + if (ret < 0)
> + return ret;
In the unlikely case where ret > 0, like the controller is very
confused, we need to fall through to allocate the default ctrl->effects.
> + } else {
> + ctrl->effects = kzalloc(sizeof(*ctrl->effects), GFP_KERNEL);
> + if (!ctrl->effects)
> + return -ENOMEM;
> + }
More information about the Linux-nvme
mailing list