[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240228190523.8377-1-vamshigajjela@google.com>
Date: Thu, 29 Feb 2024 00:35:23 +0530
From: Vamshi Gajjela <vamshigajjela@...gle.com>
To: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>, Stephen Boyd <sboyd@...nel.org>,
Johan Hovold <johan+linaro@...nel.org>
Cc: Caleb Connolly <caleb.connolly@...aro.org>, linux-kernel@...r.kernel.org,
stable@...r.kernel.org, Vamshi Gajjela <vamshigajjela@...gle.com>
Subject: [PATCH v2] spmi: hisi-spmi-controller: Fix kernel panic on rmmod
Ensure consistency in spmi_controller pointers between
spmi_controller_remove/put and driver spmi_del_controller functions.
The former requires a pointer to struct spmi_controller, while the
latter passes a pointer of struct spmi_controller_dev, leading to a
"Null pointer exception".
Signed-off-by: Vamshi Gajjela <vamshigajjela@...gle.com>
Fixes: 70f59c90c819 ("staging: spmi: add Hikey 970 SPMI controller driver")
Cc: stable@...r.kernel.org
---
v2:
- Split into two separate patches
- add Fixes and Cc stable
drivers/spmi/hisi-spmi-controller.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spmi/hisi-spmi-controller.c b/drivers/spmi/hisi-spmi-controller.c
index 9cbd473487cb..4b6189d8cc4d 100644
--- a/drivers/spmi/hisi-spmi-controller.c
+++ b/drivers/spmi/hisi-spmi-controller.c
@@ -326,7 +326,8 @@ static int spmi_controller_probe(struct platform_device *pdev)
static void spmi_del_controller(struct platform_device *pdev)
{
- struct spmi_controller *ctrl = platform_get_drvdata(pdev);
+ struct spmi_controller_dev *spmi_controller = platform_get_drvdata(pdev);
+ struct spmi_controller *ctrl = spmi_controller->controller;
spmi_controller_remove(ctrl);
spmi_controller_put(ctrl);
--
2.44.0.rc1.240.g4c46232300-goog
Powered by blists - more mailing lists