All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: Matt Hsiao <matt.hsiao@hpe.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, Ian Abbott <abbotti@mev.co.uk>
Subject: [PATCH 1/2] misc: hpilo: fix inconsistent device numbers
Date: Fri, 19 Jan 2024 13:20:17 +0000	[thread overview]
Message-ID: <20240119132032.106053-2-abbotti@mev.co.uk> (raw)
In-Reply-To: <20240119132032.106053-1-abbotti@mev.co.uk>

Each iLO device is allocated `max_ccb` minor device numbers (one for
each channel).  When `ilo_probe()` calls `device_create()` in a loop,
the minor device numbers passed to `device_create()` start at 0.  For
consistency with the call to `cdev_add()`, and for consistency with the
calls to `device_destroy()` from `ilo_remove()`, the minor device
numbers passed to `device_create()` should start at the value in the
variable `start`.  Fix it.

This is a logical bug rather than an actual bug, because the number of
supported devices is `MAX_ILO_DEV` which is defined as `1`.

Fixes: 89bcb05d9bbf ("HP iLO driver")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/misc/hpilo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c
index f1b74d3f8958..3428a0bd5550 100644
--- a/drivers/misc/hpilo.c
+++ b/drivers/misc/hpilo.c
@@ -842,7 +842,7 @@ static int ilo_probe(struct pci_dev *pdev,
 	for (minor = 0 ; minor < max_ccb; minor++) {
 		struct device *dev;
 		dev = device_create(&ilo_class, &pdev->dev,
-				    MKDEV(ilo_major, minor), NULL,
+				    MKDEV(ilo_major, start + minor), NULL,
 				    "hpilo!d%dccb%d", devnum, minor);
 		if (IS_ERR(dev))
 			dev_err(&pdev->dev, "Could not create files\n");
-- 
2.43.0


  reply	other threads:[~2024-01-19 13:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 13:20 [PATCH 0/2] misc: hpilo: fix inconsistent device numbers Ian Abbott
2024-01-19 13:20 ` Ian Abbott [this message]
2024-01-19 13:20 ` [PATCH 2/2] misc: hpilo: rename device creation loop variable Ian Abbott

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=20240119132032.106053-2-abbotti@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.hsiao@hpe.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 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.