forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/acpi/apei/erst.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * APEI Error Record Serialization Table support
34 *
....@@ -9,15 +10,6 @@
910 *
1011 * Copyright 2010 Intel Corp.
1112 * Author: Huang Ying <ying.huang@intel.com>
12
- *
13
- * This program is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU General Public License version
15
- * 2 as published by the Free Software Foundation.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
2113 */
2214
2315 #include <linux/kernel.h>
....@@ -899,7 +891,7 @@
899891 static int __init setup_erst_disable(char *str)
900892 {
901893 erst_disable = 1;
902
- return 0;
894
+ return 1;
903895 }
904896
905897 __setup("erst_disable", setup_erst_disable);
....@@ -938,17 +930,17 @@
938930 };
939931
940932 #define CPER_CREATOR_PSTORE \
941
- UUID_LE(0x75a574e3, 0x5052, 0x4b29, 0x8a, 0x8e, 0xbe, 0x2c, \
942
- 0x64, 0x90, 0xb8, 0x9d)
933
+ GUID_INIT(0x75a574e3, 0x5052, 0x4b29, 0x8a, 0x8e, 0xbe, 0x2c, \
934
+ 0x64, 0x90, 0xb8, 0x9d)
943935 #define CPER_SECTION_TYPE_DMESG \
944
- UUID_LE(0xc197e04e, 0xd545, 0x4a70, 0x9c, 0x17, 0xa5, 0x54, \
945
- 0x94, 0x19, 0xeb, 0x12)
936
+ GUID_INIT(0xc197e04e, 0xd545, 0x4a70, 0x9c, 0x17, 0xa5, 0x54, \
937
+ 0x94, 0x19, 0xeb, 0x12)
946938 #define CPER_SECTION_TYPE_DMESG_Z \
947
- UUID_LE(0x4f118707, 0x04dd, 0x4055, 0xb5, 0xdd, 0x95, 0x6d, \
948
- 0x34, 0xdd, 0xfa, 0xc6)
939
+ GUID_INIT(0x4f118707, 0x04dd, 0x4055, 0xb5, 0xdd, 0x95, 0x6d, \
940
+ 0x34, 0xdd, 0xfa, 0xc6)
949941 #define CPER_SECTION_TYPE_MCE \
950
- UUID_LE(0xfe08ffbe, 0x95e4, 0x4be7, 0xbc, 0x73, 0x40, 0x96, \
951
- 0x04, 0x4a, 0x38, 0xfc)
942
+ GUID_INIT(0xfe08ffbe, 0x95e4, 0x4be7, 0xbc, 0x73, 0x40, 0x96, \
943
+ 0x04, 0x4a, 0x38, 0xfc)
952944
953945 struct cper_pstore_record {
954946 struct cper_record_header hdr;
....@@ -1012,7 +1004,7 @@
10121004 rc = -EIO;
10131005 goto out;
10141006 }
1015
- if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0)
1007
+ if (!guid_equal(&rcd->hdr.creator_id, &CPER_CREATOR_PSTORE))
10161008 goto skip;
10171009
10181010 record->buf = kmalloc(len, GFP_KERNEL);
....@@ -1024,18 +1016,15 @@
10241016 record->id = record_id;
10251017 record->compressed = false;
10261018 record->ecc_notice_size = 0;
1027
- if (uuid_le_cmp(rcd->sec_hdr.section_type,
1028
- CPER_SECTION_TYPE_DMESG_Z) == 0) {
1019
+ if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_DMESG_Z)) {
10291020 record->type = PSTORE_TYPE_DMESG;
10301021 record->compressed = true;
1031
- } else if (uuid_le_cmp(rcd->sec_hdr.section_type,
1032
- CPER_SECTION_TYPE_DMESG) == 0)
1022
+ } else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_DMESG))
10331023 record->type = PSTORE_TYPE_DMESG;
1034
- else if (uuid_le_cmp(rcd->sec_hdr.section_type,
1035
- CPER_SECTION_TYPE_MCE) == 0)
1024
+ else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_MCE))
10361025 record->type = PSTORE_TYPE_MCE;
10371026 else
1038
- record->type = PSTORE_TYPE_UNKNOWN;
1027
+ record->type = PSTORE_TYPE_MAX;
10391028
10401029 if (rcd->hdr.validation_bits & CPER_VALID_TIMESTAMP)
10411030 record->time.tv_sec = rcd->hdr.timestamp;
....@@ -1133,7 +1122,7 @@
11331122 rc = erst_check_table(erst_tab);
11341123 if (rc) {
11351124 pr_err(FW_BUG "ERST table is invalid.\n");
1136
- goto err;
1125
+ goto err_put_erst_tab;
11371126 }
11381127
11391128 apei_resources_init(&erst_resources);
....@@ -1207,6 +1196,8 @@
12071196 apei_resources_release(&erst_resources);
12081197 err_fini:
12091198 apei_resources_fini(&erst_resources);
1199
+err_put_erst_tab:
1200
+ acpi_put_table((struct acpi_table_header *)erst_tab);
12101201 err:
12111202 erst_disable = 1;
12121203 return rc;