Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1592611

[PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files"

From Cheah Kok Cheong <thrust73@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files"
Date 2017-03-04 20:30 +0100
Message-ID <thnxn-5re-9@gated-at.bofh.it> (permalink)
References <thnxn-5re-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If comedi module is loaded with the following max allowed parameter
[comedi_num_legacy_minors=48], subsequent loading of an auto-configured
device will fail.

In this case a default to auto-configuration comedi_test module failed
to load with the following messages.

comedi_test comedi_testd: ran out of minor numbers for board device files
comedi_test comedi_testd: driver 'comedi_test' could not create device.
comedi_test: unable to auto-configure device

This is due to changes in commit 38b9722a4414
("staging: comedi: avoid releasing legacy minors automatically") which
will not allocate a minor number when comedi_num_legacy_minors equals
COMEDI_NUM_BOARD_MINORS. COMEDI_NUM_BOARD_MINORS is defined to be
0x30 which is 48.

This goes for a simple fix which limit comedi_num_legacy_minors to 47
instead of tinkering with comedi_alloc_board_minor() and
comedi_release_hardware_device().

Fix: commit 38b9722a4414 ("staging: comedi: avoid releasing legacy minors
automatically")

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
---
 drivers/staging/comedi/comedi_fops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 354d264..339854f 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2857,9 +2857,9 @@ static int __init comedi_init(void)
 
 	pr_info("version " COMEDI_RELEASE " - http://www.comedi.org\n");
 
-	if (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);
+		       COMEDI_NUM_BOARD_MINORS - 1);
 		return -EINVAL;
 	}
 
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type Cheah Kok Cheong <thrust73@gmail.com> - 2017-03-04 20:30 +0100
  [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files" Cheah Kok Cheong <thrust73@gmail.com> - 2017-03-04 20:30 +0100
    Re: [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor  numbers for board device files" Dan Carpenter <dan.carpenter@oracle.com> - 2017-03-08 07:00 +0100
      Re: [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor  numbers for board device files" Cheah Kok Cheong <thrust73@gmail.com> - 2017-03-08 11:20 +0100
        Re: [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor  numbers for board device files" Ian Abbott <abbotti@mev.co.uk> - 2017-03-08 12:20 +0100
          Re: [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor  numbers for board device files" Cheah Kok Cheong <thrust73@gmail.com> - 2017-03-08 18:10 +0100
  Re: [PATCH 1/2] Staging: comedi: comedi_fops: Change  comedi_num_legacy_minors type Greg KH <gregkh@linuxfoundation.org> - 2017-03-07 20:10 +0100
    Re: [PATCH 1/2] Staging: comedi: comedi_fops: Change  comedi_num_legacy_minors type Greg KH <gregkh@linuxfoundation.org> - 2017-03-08 11:20 +0100
      Re: [PATCH 1/2] Staging: comedi: comedi_fops: Change  comedi_num_legacy_minors type Cheah Kok Cheong <thrust73@gmail.com> - 2017-03-08 11:20 +0100
    Re: [PATCH 1/2] Staging: comedi: comedi_fops: Change  comedi_num_legacy_minors type Cheah Kok Cheong <thrust73@gmail.com> - 2017-03-08 11:40 +0100

csiph-web