Skip to content

Commit

Permalink
nvme: fix bogus kzalloc() return check in nvme_init_effects_log()
Browse files Browse the repository at this point in the history
nvme_init_effects_log() returns failure when kzalloc() is successful,
which is obviously wrong and causes failures to boot. Correct the
check.

Fixes: d4a95ad ("nvme: Add error path for xa_store in nvme_init_effects")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Jan 13, 2025
1 parent e494e45 commit 170e086
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3182,7 +3182,7 @@ static int nvme_init_effects_log(struct nvme_ctrl *ctrl,
struct nvme_effects_log *effects, *old;

effects = kzalloc(sizeof(*effects), GFP_KERNEL);
if (effects)
if (!effects)
return -ENOMEM;

old = xa_store(&ctrl->cels, csi, effects, GFP_KERNEL);
Expand Down

0 comments on commit 170e086

Please sign in to comment.