clear-pkgs-linux-iot-lts2018/0921-trusty-Check-if-eVmm-i...

65 lines
2.0 KiB
Diff
Raw Permalink Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zhou Furong <furong.zhou@intel.com>
Date: Tue, 21 Nov 2017 14:13:27 +0800
Subject: [PATCH] trusty: Check if eVmm is available before init driver
eVmm not available in recovery mode, there is a kernel panic if
trusty driver initialize without check it.
Change-Id: I21f788ab7186cddbc0b0d1a10f7896b5523d257a
Tracked-On: PKT-472
---
drivers/trusty/trusty-timer.c | 8 ++++++--
drivers/trusty/trusty-wall.c | 6 ++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/trusty/trusty-timer.c b/drivers/trusty/trusty-timer.c
2020-10-27 02:14:06 +08:00
index 0998e027984b..e88dc5f4cdf8 100644
--- a/drivers/trusty/trusty-timer.c
+++ b/drivers/trusty/trusty-timer.c
@@ -79,10 +79,15 @@ static int trusty_timer_call_notify(struct notifier_block *nb,
static int trusty_timer_probe(struct platform_device *pdev)
{
int ret;
- unsigned int cpu;
struct trusty_timer_dev_state *s;
struct trusty_timer *tt;
+ ret = trusty_check_cpuid(NULL);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "CPUID Error: Cannot find eVmm in trusty driver initialization!");
+ return -EINVAL;
+ }
+
dev_dbg(&pdev->dev, "%s\n", __func__);
if (!trusty_wall_base(pdev->dev.parent)) {
@@ -127,7 +132,6 @@ static int trusty_timer_probe(struct platform_device *pdev)
static int trusty_timer_remove(struct platform_device *pdev)
{
- unsigned int cpu;
struct trusty_timer_dev_state *s = platform_get_drvdata(pdev);
struct trusty_timer *tt;
diff --git a/drivers/trusty/trusty-wall.c b/drivers/trusty/trusty-wall.c
2020-10-27 02:14:06 +08:00
index 3c33d724b3fa..64368480c309 100644
--- a/drivers/trusty/trusty-wall.c
+++ b/drivers/trusty/trusty-wall.c
@@ -147,6 +147,12 @@ static int trusty_wall_probe(struct platform_device *pdev)
int ret;
struct trusty_wall_dev_state *s;
+ ret = trusty_check_cpuid(NULL);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "CPUID Error: Cannot find eVmm in trusty driver initialization!");
+ return -EINVAL;
+ }
+
dev_dbg(&pdev->dev, "%s\n", __func__);
s = kzalloc(sizeof(*s), GFP_KERNEL);
--
https://clearlinux.org