All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mark Brown <broonie@kernel.org>, David Jander <david@protonic.nl>
Cc: linux-spi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] spi: core: Fix error code in spi_register_controller()
Date: Tue, 14 Jun 2022 15:09:17 +0300	[thread overview]
Message-ID: <Yqh6bdNYO2XNhPBa@kili> (raw)

Return -ENOMEM if the allocation fails.  Don't return success.

Fixes: 6598b91b5ac3 ("spi: spi.c: Convert statistics to per-cpu u64_stats_t")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/spi/spi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index d94822bf3cec..85c552ba0725 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3079,6 +3079,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;
 	}
 
-- 
2.35.1


             reply	other threads:[~2022-06-14 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 12:09 Dan Carpenter [this message]
2022-06-14 17:21 ` [PATCH] spi: core: Fix error code in spi_register_controller() Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yqh6bdNYO2XNhPBa@kili \
    --to=dan.carpenter@oracle.com \
    --cc=broonie@kernel.org \
    --cc=david@protonic.nl \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.