From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: oe-linux-nfc@lists.linux.dev
Cc: linux-kernel@vger.kernel.org,
Griffin Kroah-Hartman <griffin@kroah.com>,
David Heidelberg <david@ixit.cz>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH] nfc: mrvl: spi: Unregister dev on allocation fail
Date: Tue, 7 Jul 2026 16:22:17 +0200 [thread overview]
Message-ID: <2026070716-crucial-slouchy-b8a9@gregkh> (raw)
From: Griffin Kroah-Hartman <griffin@kroah.com>
Call nfcmrvl_nci_unregister_dev() if nci_spi_allocate_spi() fails,
unwrapping the previous call to nfcmrvl_nci_register_dev() during the
nfcmrvl_spi_probe() function.
Assisted-by: gkh-clanker-2000
Cc: David Heidelberg <david@ixit.cz>
Signed-off-by: Griffin Kroah-Hartman <griffin@kroah.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nfc/nfcmrvl/spi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c
index 9c8cde1250fb..dad07c8e13b8 100644
--- a/drivers/nfc/nfcmrvl/spi.c
+++ b/drivers/nfc/nfcmrvl/spi.c
@@ -168,6 +168,10 @@ static int nfcmrvl_spi_probe(struct spi_device *spi)
drv_data->nci_spi = nci_spi_allocate_spi(drv_data->spi, 0, 10,
drv_data->priv->ndev);
+ if (!drv_data->nci_spi) {
+ nfcmrvl_nci_unregister_dev(drv_data->priv);
+ return -ENOMEM;
+ }
/* Init completion for slave handshake */
init_completion(&drv_data->handshake_completion);
--
2.55.0
reply other threads:[~2026-07-07 14:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=2026070716-crucial-slouchy-b8a9@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=david@ixit.cz \
--cc=griffin@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-linux-nfc@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®