Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752915AbdCHLla (ORCPT ); Wed, 8 Mar 2017 06:41:30 -0500 Received: from smtprelay0231.hostedemail.com ([216.40.44.231]:45991 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752658AbdCHLkN (ORCPT ); Wed, 8 Mar 2017 06:40:13 -0500 X-Session-Marker: 69616E406162626F74742E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,abbotti@mev.co.uk,:::::::::,RULES_HIT:41:355:379:599:800:960:967:973:988:989:1260:1261:1263:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1541:1593:1594:1683:1711:1730:1747:1777:1792:1801:2393:2525:2561:2564:2612:2682:2685:2859:2933:2937:2939:2942:2945:2947:2951:2954:3000:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3870:3871:3872:3873:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4362:4605:5007:7514:7652:7875:9025:9389:10004:10400:10848:11026:11232:11473:11658:11914:12043:12048:12114:12296:12438:12555:12740:12760:12895:12986:13069:13255:13311:13357:14181:14571:14685:14721:14764:14777:21080:21451:30021:30034:30054:30070,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:2,LUA_SUMMARY:none X-HE-Tag: place86_49a0dcc5a6531 X-Filterd-Recvd-Size: 2949 Subject: Re: [PATCH v2 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type To: Cheah Kok Cheong , hsweeten@visionengravers.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org References: Cc: linux-kernel@vger.kernel.org From: Ian Abbott Message-ID: <7dba80b9-a30b-79c8-4b0b-89780ecb0e78@mev.co.uk> Date: Wed, 8 Mar 2017 11:28:24 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1929 Lines: 50 On 07/03/17 18:13, Cheah Kok Cheong wrote: > Change to unsigned to allow removal of negative value check in > init section. Use smaller data type since the max possible > value currently is 48. > > Signed-off-by: Cheah Kok Cheong > --- > > V2: > -No changes. > > drivers/staging/comedi/comedi_fops.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c > index 57e8599..354d264 100644 > --- a/drivers/staging/comedi/comedi_fops.c > +++ b/drivers/staging/comedi/comedi_fops.c > @@ -76,8 +76,8 @@ struct comedi_file { > #define COMEDI_NUM_SUBDEVICE_MINORS \ > (COMEDI_NUM_MINORS - COMEDI_NUM_BOARD_MINORS) > > -static int comedi_num_legacy_minors; > -module_param(comedi_num_legacy_minors, int, 0444); > +static unsigned short comedi_num_legacy_minors; > +module_param(comedi_num_legacy_minors, ushort, 0444); > MODULE_PARM_DESC(comedi_num_legacy_minors, > "number of comedi minor devices to reserve for non-auto-configured devices (default 0)" > ); > @@ -2857,8 +2857,7 @@ static int __init comedi_init(void) > > pr_info("version " COMEDI_RELEASE " - http://www.comedi.org\n"); > > - if (comedi_num_legacy_minors < 0 || > - comedi_num_legacy_minors > COMEDI_NUM_BOARD_MINORS) { > + if (comedi_num_legacy_minors > COMEDI_NUM_BOARD_MINORS) { > pr_err("invalid value for module parameter \"comedi_num_legacy_minors\". Valid values are 0 through %i.\n", > COMEDI_NUM_BOARD_MINORS); > return -EINVAL; > Thanks. (There is no harm in making the parameter unsigned short rather than unsigned int, although it's probably not worth it as you still need to check the value. It doesn't matter either way.) Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd. E-mail: )=- -=( Web: http://www.mev.co.uk/ )=-