Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Christophe JAILLET and committed by
Jonathan Cameron
21553258 bd886cdc

+3 -1
+3 -1
drivers/iio/common/ssp_sensors/ssp_dev.c
··· 503 503 ret = spi_setup(spi); 504 504 if (ret < 0) { 505 505 dev_err(&spi->dev, "Failed to setup spi\n"); 506 - return ret; 506 + goto err_setup_spi; 507 507 } 508 508 509 509 data->fw_dl_state = SSP_FW_DL_STATE_NONE; ··· 568 568 err_setup_irq: 569 569 mutex_destroy(&data->pending_lock); 570 570 mutex_destroy(&data->comm_lock); 571 + err_setup_spi: 572 + mfd_remove_devices(&spi->dev); 571 573 572 574 dev_err(&spi->dev, "Probe failed!\n"); 573 575