Commit b72eb702 authored by Cristina Opriceana's avatar Cristina Opriceana Committed by Greg Kroah-Hartman

Staging: iio: Add error check on iio_register_device()

This patch checks if an error occurred on probe and stops the
device in order to avoid wasting power.
Signed-off-by: default avatarCristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 67573270
......@@ -550,8 +550,15 @@ static int ade7754_probe(struct spi_device *spi)
/* Get the device into a sane initial state */
ret = ade7754_initial_setup(indio_dev);
if (ret)
return ret;
return iio_device_register(indio_dev);
goto powerdown_on_error;
ret = iio_device_register(indio_dev);
if (ret)
goto powerdown_on_error;
return ret;
powerdown_on_error:
ade7754_stop_device(&indio_dev->dev);
return ret;
}
/* fixme, confirm ordering in this function */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment