From d1cd231ae41d98b2555dbff08d0c79876b5059fe Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Tue, 27 Feb 2024 07:36:39 +0100 Subject: [PATCH 14/41] super-intel: respect IMSM_DEVNAME_AS_SERIAL flag 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 Signed-off-by: Mariusz Tkaczyk --- super-intel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/super-intel.c b/super-intel.c index e61f3f6f..4babec9f 100644 --- a/super-intel.c +++ b/super-intel.c @@ -4174,17 +4174,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", -- 2.40.1