From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753436AbcHUTvl (ORCPT ); Sun, 21 Aug 2016 15:51:41 -0400 Received: from smtprelay0231.hostedemail.com ([216.40.44.231]:60833 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752998AbcHUTvk (ORCPT ); Sun, 21 Aug 2016 15:51:40 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1539:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3351:3622:3865:3866:3867:3868:4321:5007:10004:10400:10848:11026:11232:11473:11658:11914:12043:12048:12114:12438:12517:12519:12740:13069:13255:13311:13357:13439:13894:14659:14721:21080:30012:30045:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: soup30_de495e0d155c X-Filterd-Recvd-Size: 1905 Message-ID: <1471809094.3746.17.camel@perches.com> Subject: Re: [PATCH 2/2] ALSA: compress: Reduce the scope for two variables in snd_compr_set_params() From: Joe Perches To: SF Markus Elfring , alsa-devel@alsa-project.org, Jaroslav Kysela , Takashi Iwai , Vinod Koul Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Date: Sun, 21 Aug 2016 12:51:34 -0700 In-Reply-To: <03eac1fe-ff33-1759-9c2a-7914f1c6de45@users.sourceforge.net> References: <566ABCD9.1060404@users.sourceforge.net> <7233eb00-a941-4935-dce2-7cb907272d41@users.sourceforge.net> <03eac1fe-ff33-1759-9c2a-7914f1c6de45@users.sourceforge.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2016-08-21 at 21:45 +0200, SF Markus Elfring wrote: > Reduce the scope for the local variables to an if branch. [] > diff --git 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) { Likely better not reducing variable scope but changing:   if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) to if (stream->runtime->state != SNDRV_PCM_STATE_OPEN) return -EPERM; and unindenting the remainder of the code one level instead.