All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type
@ 2017-03-04 19:22 Cheah Kok Cheong
  2017-03-04 19:22 ` [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files" Cheah Kok Cheong
  2017-03-07 19:01 ` [PATCH 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type Greg KH
  0 siblings, 2 replies; 10+ messages in thread
From: Cheah Kok Cheong @ 2017-03-04 19:22 UTC (permalink / raw)
  To: abbotti, hsweeten, gregkh, devel; +Cc: linux-kernel, Cheah Kok Cheong

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>
---
 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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-03-08 17:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-04 19:22 [PATCH 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type Cheah Kok Cheong
2017-03-04 19:22 ` [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files" Cheah Kok Cheong
2017-03-08  5:54   ` Dan Carpenter
2017-03-08 10:08     ` Cheah Kok Cheong
2017-03-08 11:13       ` Ian Abbott
2017-03-08 16:59         ` Cheah Kok Cheong
2017-03-07 19:01 ` [PATCH 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type Greg KH
2017-03-08  9:38   ` Cheah Kok Cheong
2017-03-08  9:45     ` Greg KH
2017-03-08 10:16       ` Cheah Kok Cheong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.