Skip to content

Commit

Permalink
Staging: iio: Add error check on iio_register_device()
Browse files Browse the repository at this point in the history
This patch checks if an error occurred on probe and stops the
device in order to avoid wasting power.

Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Cristina Opriceana authored and Greg Kroah-Hartman committed Apr 1, 2015
1 parent 6757327 commit b72eb70
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/staging/iio/meter/ade7754.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit b72eb70

Please sign in to comment.