Skip to content

Commit 2155325

Browse files
tititiou36jic23
authored andcommitted
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: 50dd64d ("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>
1 parent bd886cd commit 2155325

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/iio/common/ssp_sensors/ssp_dev.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ static int ssp_probe(struct spi_device *spi)
503503
ret = spi_setup(spi);
504504
if (ret < 0) {
505505
dev_err(&spi->dev, "Failed to setup spi\n");
506-
return ret;
506+
goto err_setup_spi;
507507
}
508508

509509
data->fw_dl_state = SSP_FW_DL_STATE_NONE;
@@ -568,6 +568,8 @@ static int ssp_probe(struct spi_device *spi)
568568
err_setup_irq:
569569
mutex_destroy(&data->pending_lock);
570570
mutex_destroy(&data->comm_lock);
571+
err_setup_spi:
572+
mfd_remove_devices(&spi->dev);
571573

572574
dev_err(&spi->dev, "Probe failed!\n");
573575

0 commit comments

Comments
 (0)