nfc: mrvl: spi: Unregister dev on allocation fail

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>
Link: https://patch.msgid.link/2026070716-crucial-slouchy-b8a9@gregkh
Signed-off-by: David Heidelberg <david@ixit.cz>
This commit is contained in:
Griffin Kroah-Hartman 2026-07-07 16:22:17 +02:00 committed by David Heidelberg
parent 9efd35acb3
commit d832b95697
No known key found for this signature in database
GPG Key ID: 60023FC4D3492072

View File

@ -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);