mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: Cheah Kok Cheong <thrust73@gmail.com>,
	hsweeten@visionengravers.com, gregkh@linuxfoundation.org,
	devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type
Date: Wed, 8 Mar 2017 11:28:24 +0000	[thread overview]
Message-ID: <7dba80b9-a30b-79c8-4b0b-89780ecb0e78@mev.co.uk> (raw)
In-Reply-To: <cd5f3e9f6320ac0063e61f0d0457e5400091390c.1488908538.git.thrust73@gmail.com>

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 <thrust73@gmail.com>
> ---
>
> 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 <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

      parent reply	other threads:[~2017-03-08 11:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07 18:13 Cheah Kok Cheong
2017-03-07 18:13 ` [PATCH v2 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files" Cheah Kok Cheong
2017-03-08 12:36   ` Ian Abbott
2017-03-08 17:28     ` Cheah Kok Cheong
2017-03-08 11:28 ` Ian Abbott [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=7dba80b9-a30b-79c8-4b0b-89780ecb0e78@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thrust73@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®