-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy path0010-nvmem-layouts-onie-tlv-Let-device-probe-even-when-TL.patch
More file actions
49 lines (41 loc) · 1.76 KB
/
0010-nvmem-layouts-onie-tlv-Let-device-probe-even-when-TL.patch
File metadata and controls
49 lines (41 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
From f1470c4f8c8fb850e93ccbd1a976516687b0c577 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/47] 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 0967a32319a2..48547d5bb502 100644
--- a/drivers/nvmem/layouts/onie-tlv.c
+++ b/drivers/nvmem/layouts/onie-tlv.c
@@ -197,7 +197,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);
@@ -205,7 +205,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);
@@ -217,7 +217,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);