|
|
d5c737 |
From 74aa359f7474040aef2bd18b66201412f853b5c4 Mon Sep 17 00:00:00 2001
|
|
|
d5c737 |
From: Peter Jones <pjones@redhat.com>
|
|
|
d5c737 |
Date: Wed, 2 Oct 2019 17:01:00 -0400
|
|
|
d5c737 |
Subject: [PATCH 55/63] Fix the error path in set_disk_and_part_name()
|
|
|
d5c737 |
|
|
|
d5c737 |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
d5c737 |
---
|
|
|
d5c737 |
src/linux.c | 10 +++++++++-
|
|
|
d5c737 |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
d5c737 |
|
|
|
d5c737 |
diff --git a/src/linux.c b/src/linux.c
|
|
|
d5c737 |
index 45f07d3913c..73c67cbafd3 100644
|
|
|
d5c737 |
--- a/src/linux.c
|
|
|
d5c737 |
+++ b/src/linux.c
|
|
|
d5c737 |
@@ -169,6 +169,8 @@ set_disk_name(struct device *dev, const char * const fmt, ...)
|
|
|
d5c737 |
int HIDDEN
|
|
|
d5c737 |
set_disk_and_part_name(struct device *dev)
|
|
|
d5c737 |
{
|
|
|
d5c737 |
+ int rc = -1;
|
|
|
d5c737 |
+
|
|
|
d5c737 |
/*
|
|
|
d5c737 |
* results are like such:
|
|
|
d5c737 |
* maj:min -> ../../devices/pci$PCI_STUFF/$BLOCKDEV_STUFF/block/$DISK/$PART
|
|
|
d5c737 |
@@ -200,6 +202,7 @@ set_disk_and_part_name(struct device *dev)
|
|
|
d5c737 |
set_disk_name(dev, "%s", penultimate);
|
|
|
d5c737 |
set_part_name(dev, "%s", ultimate);
|
|
|
d5c737 |
debug("disk:%s part:%s", penultimate, ultimate);
|
|
|
d5c737 |
+ rc = 0;
|
|
|
d5c737 |
} else if (ultimate && approximate && !strcmp(approximate, "nvme")) {
|
|
|
d5c737 |
/*
|
|
|
d5c737 |
* 259:0 -> ../../devices/pci0000:00/0000:00:1d.0/0000:05:00.0/nvme/nvme0/nvme0n1
|
|
|
d5c737 |
@@ -207,6 +210,7 @@ set_disk_and_part_name(struct device *dev)
|
|
|
d5c737 |
set_disk_name(dev, "%s", ultimate);
|
|
|
d5c737 |
set_part_name(dev, "%sp%d", ultimate, dev->part);
|
|
|
d5c737 |
debug("disk:%s part:%sp%d", ultimate, ultimate, dev->part);
|
|
|
d5c737 |
+ rc = 0;
|
|
|
d5c737 |
} else if (ultimate && penultimate && !strcmp(penultimate, "block")) {
|
|
|
d5c737 |
/*
|
|
|
d5c737 |
* 253:0 -> ../../devices/virtual/block/dm-0 (... I guess)
|
|
|
d5c737 |
@@ -220,15 +224,19 @@ set_disk_and_part_name(struct device *dev)
|
|
|
d5c737 |
set_disk_name(dev, "%s", ultimate);
|
|
|
d5c737 |
set_part_name(dev, "%s%d", ultimate, dev->part);
|
|
|
d5c737 |
debug("disk:%s part:%s%d", ultimate, ultimate, dev->part);
|
|
|
d5c737 |
+ rc = 0;
|
|
|
d5c737 |
} else if (ultimate && approximate && !strcmp(approximate, "mtd")) {
|
|
|
d5c737 |
/*
|
|
|
d5c737 |
* 31:0 -> ../../devices/platform/1e000000.palmbus/1e000b00.spi/spi_master/spi32766/spi32766.0/mtd/mtd0/mtdblock0
|
|
|
d5c737 |
*/
|
|
|
d5c737 |
set_disk_name(dev, "%s", ultimate);
|
|
|
d5c737 |
debug("disk:%s", ultimate);
|
|
|
d5c737 |
+ rc = 0;
|
|
|
d5c737 |
}
|
|
|
d5c737 |
|
|
|
d5c737 |
- return 0;
|
|
|
d5c737 |
+ if (rc < 0)
|
|
|
d5c737 |
+ efi_error("Could not parse disk name:\"%s\"", dev->link);
|
|
|
d5c737 |
+ return rc;
|
|
|
d5c737 |
}
|
|
|
d5c737 |
|
|
|
d5c737 |
static struct dev_probe *dev_probes[] = {
|
|
|
d5c737 |
--
|
|
|
d5c737 |
2.26.2
|
|
|
d5c737 |
|