summaryrefslogtreecommitdiff
path: root/Kernel/Storage
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-13 00:20:42 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-01-13 00:20:08 -0800
commit640284067008e8f7bf8edd79c9d25b771b429f49 (patch)
tree96d0958b88df108bcb8a3453af0d783b0b51dc9c /Kernel/Storage
parentec1f3abd34e5dc2bca2548777267bc094a74dc1f (diff)
downloadserenity-640284067008e8f7bf8edd79c9d25b771b429f49.zip
Kernel: Replace {KString => String}::formatted in determine_boot_device
Diffstat (limited to 'Kernel/Storage')
-rw-r--r--Kernel/Storage/StorageManagement.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp
index 96730a31d2..d7a1692756 100644
--- a/Kernel/Storage/StorageManagement.cpp
+++ b/Kernel/Storage/StorageManagement.cpp
@@ -145,11 +145,14 @@ UNMAP_AFTER_INIT void StorageManagement::determine_boot_device()
// number in the device name indicates the node, e.g. /dev/nvme0n1 we need to append a "p" character
// so that we can properly distinguish the partition index from the device itself
char storage_name_last_char = *(storage_device.early_storage_name().end() - 1);
- String early_storage_name;
- if (storage_name_last_char >= '0' && storage_name_last_char <= '9')
- early_storage_name = String::formatted("{}p", storage_device.early_storage_name());
- else
+ OwnPtr<KString> normalized_name;
+ StringView early_storage_name;
+ if (storage_name_last_char >= '0' && storage_name_last_char <= '9') {
+ normalized_name = MUST(KString::formatted("{}p", storage_device.early_storage_name()));
+ early_storage_name = normalized_name->view();
+ } else {
early_storage_name = storage_device.early_storage_name();
+ }
auto start_storage_name = storage_name.substring_view(0, min(early_storage_name.length(), storage_name.length()));