[PATCH 7/9] nvme: assign known effects at controller initialization time

Kanchan Joshi joshi.k at samsung.com
Thu Dec 15 05:15:31 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;
>+	} else {
>+		ctrl->effects = kzalloc(sizeof(*ctrl->effects), GFP_KERNEL);
>+		if (!ctrl->effects)
>+			return -ENOMEM;

Maybe I am missing something obvious, but when ctrl->effects gets
freed if it was allocated via the else path above?
It's not going to that "ctrl->cels" xarray which gets freed during
nvme_free_ctrl.


More information about the Linux-nvme mailing list