From: Varsha Rao <rvarsha016@gmail.com>
To: Ian Abbott <abbotti@mev.co.uk>,
H Hartley Sweeten <hsweeten@visionengravers.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: outreachy-kernel@googlegroups.com
Subject: [PATCH] staging: comedi: Compress return logic into one line.
Date: Sun, 12 Mar 2017 18:01:35 +0530 [thread overview]
Message-ID: <58c53fae.4737620a.4ce3e.692c@mx.google.com> (raw)
Simplify function return by merging assignment and return into a single
line. The following coccinelle script is used to fix this issue.
@@
expression e,ret;
@@
-ret = e;
-return ret;
+return e;
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
drivers/staging/comedi/drivers.c | 3 +--
drivers/staging/comedi/drivers/cb_pcidas64.c | 8 ++------
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index a5bf2cc..76e399c 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -86,8 +86,7 @@ static void comedi_clear_hw_dev(struct comedi_device *dev)
*/
void *comedi_alloc_devpriv(struct comedi_device *dev, size_t size)
{
- dev->private = kzalloc(size, GFP_KERNEL);
- return dev->private;
+ return kzalloc(size, GFP_KERNEL);
}
EXPORT_SYMBOL_GPL(comedi_alloc_devpriv);
diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index 3b98193..be65f71 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1394,9 +1394,7 @@ static int set_ai_fifo_segment_length(struct comedi_device *dev,
writew(devpriv->fifo_size_bits,
devpriv->main_iobase + FIFO_SIZE_REG);
- devpriv->ai_fifo_segment_length = num_increments * increment_size;
-
- return devpriv->ai_fifo_segment_length;
+ return num_increments * increment_size;
}
/*
@@ -1417,9 +1415,7 @@ static int set_ai_fifo_size(struct comedi_device *dev, unsigned int num_samples)
if (retval < 0)
return retval;
- num_samples = retval * fifo->num_segments * fifo->sample_packing_ratio;
-
- return num_samples;
+ return retval * fifo->num_segments * fifo->sample_packing_ratio;
}
/* query length of fifo */
--
2.9.3
next reply other threads:[~2017-03-12 12:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-12 12:31 Varsha Rao [this message]
2017-03-12 12:35 ` [Outreachy kernel] [PATCH] staging: comedi: Compress return logic into one line Julia Lawall
2017-03-12 13:53 ` Varsha Rao
2017-03-12 13:55 ` Greg Kroah-Hartman
2017-03-12 14:07 ` Varsha Rao
2017-03-12 14:35 ` [Outreachy kernel] " Greg KH
2017-03-12 14:35 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58c53fae.4737620a.4ce3e.692c@mx.google.com \
--to=rvarsha016@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.