All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: thesven73@gmail.com, hofrat@osadl.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: fieldbus: anybuss: Remove variables
Date: Fri, 24 May 2019 08:56:40 +0200	[thread overview]
Message-ID: <20190524065640.GD3600@kroah.com> (raw)
In-Reply-To: <20190524060328.3827-1-nishkadg.linux@gmail.com>

On Fri, May 24, 2019 at 11:33:28AM +0530, Nishka Dasgupta wrote:
> The local variable cd, used in multiple functions, is immediately passed
> to another function call, whose result is returned. As that is the only
> use of cd, it can be replaced with its variable.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
>  drivers/staging/fieldbus/anybuss/host.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)

Your subject line might say:
	"remove unneeded temporary variables"
or something like that?

> 
> diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c
> index f69dc4930457..9679cd0b737b 100644
> --- a/drivers/staging/fieldbus/anybuss/host.c
> +++ b/drivers/staging/fieldbus/anybuss/host.c
> @@ -1046,10 +1046,8 @@ EXPORT_SYMBOL_GPL(anybuss_start_init);
>  
>  int anybuss_finish_init(struct anybuss_client *client)
>  {
> -	struct anybuss_host *cd = client->host;
> -
> -	return _anybus_mbox_cmd(cd, CMD_END_INIT, false, NULL, 0,
> -					NULL, 0, NULL, 0);
> +	return _anybus_mbox_cmd(client->host, CMD_END_INIT, false, NULL, 0,
> +				NULL, 0, NULL, 0);
>  }

While a potential change, this really doesn't help anything be it object
code size, or make anything easier to understand.

Again, don't change things just because a tool said it could be changed,
think about what you are doing and why it would, or would not, be
something that is worth doing.

thanks,

greg k-h

      reply	other threads:[~2019-05-24  6:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24  6:03 [PATCH] staging: fieldbus: anybuss: Remove variables Nishka Dasgupta
2019-05-24  6:56 ` Greg KH [this message]

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=20190524065640.GD3600@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=hofrat@osadl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nishkadg.linux@gmail.com \
    --cc=thesven73@gmail.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.