diff options
author | Swen Kalski <kalski.swen@gmail.com> | 2021-03-25 16:35:20 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-26 17:00:16 +0300 |
commit | d70fb897113d885a8b457ac2bcbb7802b46770b3 (patch) | |
tree | f3036ea6e57f84968525a04a244f11e839ec6fbe /drivers/staging/comedi | |
parent | 6f08cc6c2fdd3e87098afb8cb86ed31ab6597eff (diff) | |
download | linux-d70fb897113d885a8b457ac2bcbb7802b46770b3.tar.xz |
Staging: comedi: remove unnecessary else statement
Removal of an unnecessary else in statging/comedi/comedi_buf.c
Add an early Return and removed the unleashed the else condition
for better readability int staging/comedi drivers.
Signed-off-by: Swen Kalski <kalski.swen@gmail.com>
Link: https://lore.kernel.org/r/20210325133520.GA594125@m17r3en
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r-- | drivers/staging/comedi/comedi_buf.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index 3ef3ddabf139..06bfc859ab31 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -371,35 +371,35 @@ static unsigned int comedi_buf_munge(struct comedi_subdevice *s, if (!s->munge || (async->cmd.flags & CMDF_RAWDATA)) { async->munge_count += num_bytes; - count = num_bytes; - } else { - /* don't munge partial samples */ - num_bytes -= num_bytes % num_sample_bytes; - while (count < num_bytes) { - int block_size = num_bytes - count; - unsigned int buf_end; + return num_bytes; + } - buf_end = async->prealloc_bufsz - async->munge_ptr; - if (block_size > buf_end) - block_size = buf_end; + /* don't munge partial samples */ + num_bytes -= num_bytes % num_sample_bytes; + while (count < num_bytes) { + int block_size = num_bytes - count; + unsigned int buf_end; - s->munge(s->device, s, - async->prealloc_buf + async->munge_ptr, - block_size, async->munge_chan); + buf_end = async->prealloc_bufsz - async->munge_ptr; + if (block_size > buf_end) + block_size = buf_end; - /* - * ensure data is munged in buffer before the - * async buffer munge_count is incremented - */ - smp_wmb(); - - async->munge_chan += block_size / num_sample_bytes; - async->munge_chan %= async->cmd.chanlist_len; - async->munge_count += block_size; - async->munge_ptr += block_size; - async->munge_ptr %= async->prealloc_bufsz; - count += block_size; - } + s->munge(s->device, s, + async->prealloc_buf + async->munge_ptr, + block_size, async->munge_chan); + + /* + * ensure data is munged in buffer before the + * async buffer munge_count is incremented + */ + smp_wmb(); + + async->munge_chan += block_size / num_sample_bytes; + async->munge_chan %= async->cmd.chanlist_len; + async->munge_count += block_size; + async->munge_ptr += block_size; + async->munge_ptr %= async->prealloc_bufsz; + count += block_size; } return count; |