Re: [PATCH 2/2] ALSA: compress: Reduce the scope for two variables in snd_compr_set_params()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 21, 2016 at 04:36:22PM -0400, Julia Lawall wrote:
> 
> 
> On Sun, 21 Aug 2016, SF Markus Elfring wrote:
> 
> > From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> > Date: Sun, 21 Aug 2016 21:26:18 +0200
> >
> > Reduce the scope for the local variables to an if branch.
> >
> > Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> > ---
> >  sound/core/compress_offload.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> > index 583d407..b43aec5 100644
> > --- a/sound/core/compress_offload.c
> > +++ b/sound/core/compress_offload.c
> > @@ -545,14 +545,14 @@ static int snd_compress_check_input(struct snd_compr_params *params)
> >  static int
> >  snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
> >  {
> > -	struct snd_compr_params *params;
> > -	int retval;
> > -
> >  	if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
> >  		/*
> >  		 * we should allow parameter change only when stream has been
> >  		 * opened not in other cases
> >  		 */
> > +		int retval;
> > +		struct snd_compr_params *params;
> 
> I don't like this at all.  Local variables should be at the top of the
> function, not hiding under 4 lines of comments in the middle of the code.

I agree with you this, it doesn't help IMO as well

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux