Skip to content

Commit

Permalink
imu: inv_mpu6050: cleanup on error check
Browse files Browse the repository at this point in the history
Signed-off-by: Varka Bhadram <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
bhadram authored and jic23 committed Jan 27, 2015
1 parent eec06b8 commit 76cd2e7
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,29 +120,28 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev)
"%s-dev%d",
indio_dev->name,
indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
}
if (!st->trig)
return -ENOMEM;

ret = devm_request_irq(&indio_dev->dev, st->client->irq,
&iio_trigger_generic_data_rdy_poll,
IRQF_TRIGGER_RISING,
"inv_mpu",
st->trig);
if (ret)
goto error_ret;
return ret;

st->trig->dev.parent = &st->client->dev;
st->trig->ops = &inv_mpu_trigger_ops;
iio_trigger_set_drvdata(st->trig, indio_dev);

ret = iio_trigger_register(st->trig);
if (ret)
goto error_ret;
return ret;

indio_dev->trig = iio_trigger_get(st->trig);

return 0;

error_ret:
return ret;
}

void inv_mpu6050_remove_trigger(struct inv_mpu6050_state *st)
Expand Down

0 comments on commit 76cd2e7

Please sign in to comment.