]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio:common:ssp_sensors: Fix an error handling path ssp_probe()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 10 Oct 2025 18:58:48 +0000 (20:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:24:58 +0000 (06:24 +0900)
commit 21553258b94861a73d7f2cf15469d69240e1170d upstream.

If an error occurs after a successful mfd_add_devices() call, it should be
undone by a corresponding mfd_remove_devices() call, as already done in the
remove function.

Fixes: 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/common/ssp_sensors/ssp_dev.c

index e64d242145e04c7918c1d4f9d7f55ec376af2188..0c6629da2112322275d3a8a450003abe225d2d33 100644 (file)
@@ -503,7 +503,7 @@ static int ssp_probe(struct spi_device *spi)
        ret = spi_setup(spi);
        if (ret < 0) {
                dev_err(&spi->dev, "Failed to setup spi\n");
-               return ret;
+               goto err_setup_spi;
        }
 
        data->fw_dl_state = SSP_FW_DL_STATE_NONE;
@@ -568,6 +568,8 @@ err_read_reg:
 err_setup_irq:
        mutex_destroy(&data->pending_lock);
        mutex_destroy(&data->comm_lock);
+err_setup_spi:
+       mfd_remove_devices(&spi->dev);
 
        dev_err(&spi->dev, "Probe failed!\n");