Commit 3879089b authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jonathan Cameron

staging:iio:max1363: Don't free uninitialized variable

It is possible that on one of the error paths we are going to try to free
'rxbuf', even though it has not been allocated yet, which cause the following
warning:
	drivers/staging/iio/adc/max1363_ring.c: In function 'max1363_trigger_handler':
		drivers/staging/iio/adc/max1363_ring.c:87:7: warning: 'rxbuf' may be used
		uninitialized in this function
Reported-by: default avatarFengguang Wu <wfg@linux.intel.com>
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
parent 7b762741
...@@ -74,7 +74,7 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p) ...@@ -74,7 +74,7 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p)
else else
b_sent = i2c_master_recv(st->client, rxbuf, numvals); b_sent = i2c_master_recv(st->client, rxbuf, numvals);
if (b_sent < 0) if (b_sent < 0)
goto done; goto done_free;
time_ns = iio_get_time_ns(); time_ns = iio_get_time_ns();
...@@ -82,9 +82,10 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p) ...@@ -82,9 +82,10 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p)
memcpy(rxbuf + d_size - sizeof(s64), &time_ns, sizeof(time_ns)); memcpy(rxbuf + d_size - sizeof(s64), &time_ns, sizeof(time_ns));
iio_push_to_buffer(indio_dev->buffer, rxbuf, time_ns); iio_push_to_buffer(indio_dev->buffer, rxbuf, time_ns);
done_free:
kfree(rxbuf);
done: done:
iio_trigger_notify_done(indio_dev->trig); iio_trigger_notify_done(indio_dev->trig);
kfree(rxbuf);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
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