Commit 9572588c authored by Peter Meerwald's avatar Peter Meerwald Committed by Jonathan Cameron

iio: Minor cleanups of industrialio-buffer

adding one return value check
fix one kerneldoc
Signed-off-by: default avatarPeter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 7a1aeba7
...@@ -243,6 +243,8 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev, ...@@ -243,6 +243,8 @@ static int iio_buffer_add_channel_sysfs(struct iio_dev *indio_dev,
0, 0,
&indio_dev->dev, &indio_dev->dev,
&buffer->scan_el_dev_attr_list); &buffer->scan_el_dev_attr_list);
if (ret)
goto error_ret;
attrcount++; attrcount++;
ret = attrcount; ret = attrcount;
error_ret: error_ret:
...@@ -412,7 +414,7 @@ ssize_t iio_buffer_show_enable(struct device *dev, ...@@ -412,7 +414,7 @@ ssize_t iio_buffer_show_enable(struct device *dev,
} }
EXPORT_SYMBOL(iio_buffer_show_enable); EXPORT_SYMBOL(iio_buffer_show_enable);
/* note NULL used as error indicator as it doesn't make sense. */ /* Note NULL used as error indicator as it doesn't make sense. */
static const unsigned long *iio_scan_mask_match(const unsigned long *av_masks, static const unsigned long *iio_scan_mask_match(const unsigned long *av_masks,
unsigned int masklength, unsigned int masklength,
const unsigned long *mask) const unsigned long *mask)
...@@ -494,7 +496,7 @@ int iio_update_buffers(struct iio_dev *indio_dev, ...@@ -494,7 +496,7 @@ int iio_update_buffers(struct iio_dev *indio_dev,
return 0; return 0;
} }
/* What scan mask do we actually have ?*/ /* What scan mask do we actually have? */
compound_mask = kcalloc(BITS_TO_LONGS(indio_dev->masklength), compound_mask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
sizeof(long), GFP_KERNEL); sizeof(long), GFP_KERNEL);
if (compound_mask == NULL) { if (compound_mask == NULL) {
...@@ -560,7 +562,7 @@ int iio_update_buffers(struct iio_dev *indio_dev, ...@@ -560,7 +562,7 @@ int iio_update_buffers(struct iio_dev *indio_dev,
goto error_run_postdisable; goto error_run_postdisable;
} }
} }
/* Definitely possible for devices to support both of these.*/ /* Definitely possible for devices to support both of these. */
if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) { if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) {
if (!indio_dev->trig) { if (!indio_dev->trig) {
printk(KERN_INFO "Buffer not started: no trigger\n"); printk(KERN_INFO "Buffer not started: no trigger\n");
...@@ -571,7 +573,7 @@ int iio_update_buffers(struct iio_dev *indio_dev, ...@@ -571,7 +573,7 @@ int iio_update_buffers(struct iio_dev *indio_dev,
indio_dev->currentmode = INDIO_BUFFER_TRIGGERED; indio_dev->currentmode = INDIO_BUFFER_TRIGGERED;
} else if (indio_dev->modes & INDIO_BUFFER_HARDWARE) { } else if (indio_dev->modes & INDIO_BUFFER_HARDWARE) {
indio_dev->currentmode = INDIO_BUFFER_HARDWARE; indio_dev->currentmode = INDIO_BUFFER_HARDWARE;
} else { /* should never be reached */ } else { /* Should never be reached */
ret = -EINVAL; ret = -EINVAL;
goto error_run_postdisable; goto error_run_postdisable;
} }
...@@ -694,6 +696,7 @@ static bool iio_validate_scan_mask(struct iio_dev *indio_dev, ...@@ -694,6 +696,7 @@ static bool iio_validate_scan_mask(struct iio_dev *indio_dev,
/** /**
* iio_scan_mask_set() - set particular bit in the scan mask * iio_scan_mask_set() - set particular bit in the scan mask
* @indio_dev: the iio device
* @buffer: the buffer whose scan mask we are interested in * @buffer: the buffer whose scan mask we are interested in
* @bit: the bit to be set. * @bit: the bit to be set.
* *
...@@ -714,7 +717,7 @@ int iio_scan_mask_set(struct iio_dev *indio_dev, ...@@ -714,7 +717,7 @@ int iio_scan_mask_set(struct iio_dev *indio_dev,
if (trialmask == NULL) if (trialmask == NULL)
return -ENOMEM; return -ENOMEM;
if (!indio_dev->masklength) { if (!indio_dev->masklength) {
WARN_ON("trying to set scanmask prior to registering buffer\n"); WARN_ON("Trying to set scanmask prior to registering buffer\n");
goto err_invalid_mask; goto err_invalid_mask;
} }
bitmap_copy(trialmask, buffer->scan_mask, indio_dev->masklength); bitmap_copy(trialmask, buffer->scan_mask, indio_dev->masklength);
......
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