Skip to content

Commit

Permalink
spi: core: Fix error code in spi_register_controller()
Browse files Browse the repository at this point in the history
Return -ENOMEM if the allocation fails.  Don't return success.

Fixes: 6598b91 ("spi: spi.c: Convert statistics to per-cpu u64_stats_t")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/Yqh6bdNYO2XNhPBa@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Dan Carpenter authored and Mark Brown committed Jun 14, 2022
1 parent d38dc01 commit d52b095
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3082,6 +3082,7 @@ int spi_register_controller(struct spi_controller *ctlr)
ctlr->pcpu_statistics = spi_alloc_pcpu_stats(dev);
if (!ctlr->pcpu_statistics) {
dev_err(dev, "Error allocating per-cpu statistics\n");
status = -ENOMEM;
goto destroy_queue;
}

Expand Down

0 comments on commit d52b095

Please sign in to comment.