summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/dac/mcp4821.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iio/dac/mcp4821.c b/drivers/iio/dac/mcp4821.c
index 29187f2a9d3c..102ae3718514 100644
--- a/drivers/iio/dac/mcp4821.c
+++ b/drivers/iio/dac/mcp4821.c
@@ -115,11 +115,10 @@ static int mcp4821_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val,
int *val2, long mask)
{
- struct mcp4821_state *state;
+ struct mcp4821_state *state = iio_priv(indio_dev);
switch (mask) {
case IIO_CHAN_INFO_RAW:
- state = iio_priv(indio_dev);
*val = state->dac_value[chan->channel];
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE: