mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
From 1d26447cb586481eee5c4564b68f49c6731b2c83 Mon Sep 17 00:00:00 2001
|
|
From: Tobias Waldekranz <tobias@waldekranz.com>
|
|
Date: Fri, 24 Nov 2023 23:29:55 +0100
|
|
Subject: [PATCH 10/50] nvmem: layouts: onie-tlv: Let device probe even when
|
|
TLV is invalid
|
|
|
|
Before this change, probing an NVMEM device, expected to contain a
|
|
valid TLV, would fail if it had not been provisioned yet. But an
|
|
obvious way of provisioning is to write the TLV to the nvmem
|
|
attribute, which would not be possible because the device would not
|
|
be successfully probed.
|
|
|
|
Therefore, settle for reporting data corruption issues in the log, and
|
|
simply refrain from registering any cells in those cases.
|
|
---
|
|
drivers/nvmem/layouts/onie-tlv.c | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/drivers/nvmem/layouts/onie-tlv.c b/drivers/nvmem/layouts/onie-tlv.c
|
|
index 8b0f3c1b8a0e..de85690aaa30 100644
|
|
--- a/drivers/nvmem/layouts/onie-tlv.c
|
|
+++ b/drivers/nvmem/layouts/onie-tlv.c
|
|
@@ -198,7 +198,7 @@ static int onie_tlv_parse_table(struct nvmem_layout *layout)
|
|
|
|
if (!onie_tlv_hdr_is_valid(dev, &hdr)) {
|
|
dev_err(dev, "Invalid ONIE TLV header\n");
|
|
- return -EINVAL;
|
|
+ return 0;
|
|
}
|
|
|
|
hdr_len = sizeof(hdr.id) + sizeof(hdr.version) + sizeof(hdr.data_len);
|
|
@@ -206,7 +206,7 @@ static int onie_tlv_parse_table(struct nvmem_layout *layout)
|
|
table_len = hdr_len + data_len;
|
|
if (table_len > ONIE_TLV_MAX_LEN) {
|
|
dev_err(dev, "Invalid ONIE TLV data length\n");
|
|
- return -EINVAL;
|
|
+ return 0;
|
|
}
|
|
|
|
table = devm_kmalloc(dev, table_len, GFP_KERNEL);
|
|
@@ -218,7 +218,7 @@ static int onie_tlv_parse_table(struct nvmem_layout *layout)
|
|
return ret;
|
|
|
|
if (!onie_tlv_crc_is_valid(dev, table_len, table))
|
|
- return -EINVAL;
|
|
+ return 0;
|
|
|
|
data = table + hdr_len;
|
|
ret = onie_tlv_add_cells(dev, nvmem, data_len, data);
|