diff mbox series

super-intel: respect IMSM_DEVNAME_AS_SERIAL flag

Message ID 20240227063639.31396-1-kinga.tanska@intel.com (mailing list archive)
State Accepted
Headers show
Series super-intel: respect IMSM_DEVNAME_AS_SERIAL flag | expand

Commit Message

Kinga Tanska Feb. 27, 2024, 6:36 a.m. UTC
IMSM_DEVNAME_AS_SERIAL flag was respected only when searching
serial using nvme or scsi device wasn't successful. This
flag shall be applied first, to have user settings with
the highest priority.

Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
---
 super-intel.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Mariusz Tkaczyk Feb. 29, 2024, 1:15 p.m. UTC | #1
On Tue, 27 Feb 2024 07:36:39 +0100
Kinga Tanska <kinga.tanska@intel.com> wrote:

> IMSM_DEVNAME_AS_SERIAL flag was respected only when searching
> serial using nvme or scsi device wasn't successful. This
> flag shall be applied first, to have user settings with
> the highest priority.
> 
> Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
> ---

Applied!

Thanks,
Mariusz
diff mbox series

Patch

diff --git a/super-intel.c b/super-intel.c
index 6bdd5c4c..880e5977 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4172,17 +4172,17 @@  static int imsm_read_serial(int fd, char *devname,
 
 	memset(buf, 0, sizeof(buf));
 
+	if (check_env("IMSM_DEVNAME_AS_SERIAL")) {
+		memset(serial, 0, serial_buf_len);
+		fd2devname(fd, (char *) serial);
+		return 0;
+	}
+
 	rv = nvme_get_serial(fd, buf, sizeof(buf));
 
 	if (rv)
 		rv = scsi_get_serial(fd, buf, sizeof(buf));
 
-	if (rv && check_env("IMSM_DEVNAME_AS_SERIAL")) {
-		memset(serial, 0, MAX_RAID_SERIAL_LEN);
-		fd2devname(fd, (char *) serial);
-		return 0;
-	}
-
 	if (rv != 0) {
 		if (devname)
 			pr_err("Failed to retrieve serial for %s\n",