From: Greg KH <gregkh@linuxfoundation.org>
To: Nishka Dasgupta <nishka.dasgupta@yahoo.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: fieldbus: anybuss: Remove unnecessary variables
Date: Thu, 23 May 2019 09:22:20 +0200 [thread overview]
Message-ID: <20190523072220.GC24998@kroah.com> (raw)
In-Reply-To: <20190523063504.10530-1-nishka.dasgupta@yahoo.com>
On Thu, May 23, 2019 at 12:05:01PM +0530, Nishka Dasgupta wrote:
> In the functions export_reset_0 and export_reset_1 in arcx-anybus.c,
> the only operation performed before return is passing the variable cd
> (which takes the value of a function call on one of the parameters) as
> argument to another function. Hence the variable cd can be removed.
> Issue found using Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishka.dasgupta@yahoo.com>
> ---
> drivers/staging/fieldbus/anybuss/arcx-anybus.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/fieldbus/anybuss/arcx-anybus.c b/drivers/staging/fieldbus/anybuss/arcx-anybus.c
> index 2ecffa42e561..e245f940a5c4 100644
> --- a/drivers/staging/fieldbus/anybuss/arcx-anybus.c
> +++ b/drivers/staging/fieldbus/anybuss/arcx-anybus.c
> @@ -87,16 +87,12 @@ static int anybuss_reset(struct controller_priv *cd,
>
> static void export_reset_0(struct device *dev, bool assert)
> {
> - struct controller_priv *cd = dev_get_drvdata(dev);
> -
> - anybuss_reset(cd, 0, assert);
> + anybuss_reset(dev_get_drvdata(dev), 0, assert);
> }
While your patch is "correct", it's not the nicest thing. The way the
code looks today is to make it obvious we are passing a pointer to a
struct controller_priv() into anybuss_reset(). But with your change, it
looks like we are passing any random void pointer to it.
So I'd prefer the original code please.
Also, you forgot to cc: Sven on this patch, please always use the output
of scripts/get_maintainer.pl.
thanks,
greg k-h
next parent reply other threads:[~2019-05-23 7:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190523063504.10530-1-nishka.dasgupta@yahoo.com>
2019-05-23 7:22 ` Greg KH [this message]
[not found] ` <b8cc12d9-2fe3-754b-be08-f23055a31ffe@yahoo.com>
2019-05-23 8:27 ` [PATCH] staging: fieldbus: anybuss: Remove unnecessary variables Jeremy Sowden
2019-05-23 9:09 ` Dan Carpenter
2019-05-23 13:02 ` Sven Van Asbroeck
2019-05-23 18:05 ` Greg KH
2019-05-23 8:42 ` 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=20190523072220.GC24998@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nishka.dasgupta@yahoo.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.