Commit 21553258 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Jonathan Cameron
Browse files

iio:common:ssp_sensors: Fix an error handling path ssp_probe()



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: 50dd64d5 ("iio: common: ssp_sensors: Add sensorhub driver")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarNuno Sá <nuno.sa@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent bd886cdc
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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 @@ static int ssp_probe(struct spi_device *spi)
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");