[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1607211550580.2927@hadrien>
Date: Thu, 21 Jul 2016 15:51:23 +0200 (CEST)
From: Julia Lawall <julia.lawall@...6.fr>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Wolfram Sang <wsa@...-dreams.de>, devel@...verdev.osuosl.org,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 9/9] staging: ks7010: Delete three unnecessary variable
initialisations
On Thu, 21 Jul 2016, SF Markus Elfring wrote:
> >> @@ -323,14 +323,14 @@ static void tx_device_task(void *dev)
> >> {
> >> struct ks_wlan_private *priv = (struct ks_wlan_private *)dev;
> >> struct tx_device_buffer *sp;
> >> - int rc = 0;
> >>
> >> DPRINTK(4, "\n");
> >> if (cnt_txqbody(priv) > 0
> >> && atomic_read(&priv->psstatus.status) != PS_SNOOZE) {
> >> sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
> >> if (priv->dev_state >= DEVICE_STATE_BOOT) {
> >> - rc = write_to_device(priv, sp->sendp, sp->size);
> >> + int rc = write_to_device(priv, sp->sendp, sp->size);
> >
> > This does not look appealing to me, neither the declaration in the middle
> > of the function, nor the intiialization to the result of a complex
> > expression, nor the separation of the call and the error checking code by
> > a blank line. There is nothing wrong with having the rc variable be
> > declared at the the top of the function, in its normal place.
>
> * Do you occasionally care for a refactoring like "Reduce scope of variable"?
>
> http://refactoring.com/catalog/reduceScopeOfVariable.html
Probably not. Certainly not in this case.
> * How do you think about to remove the extra assignment at the beginning
> of this function implementation?
If the value is not useful, then it can go.
julia
> Regards,
> Markus
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Powered by blists - more mailing lists