* [PATCH v1] bus: mhi: host: Fix potential kernel panic by calling dev_err
@ 2025-09-02 16:56 Adam Xue
2025-09-04 9:30 ` Krishna Chaitanya Chundru
0 siblings, 1 reply; 3+ messages in thread
From: Adam Xue @ 2025-09-02 16:56 UTC (permalink / raw)
To: mani, jeff.hugo, quic_yabdulra, chentao, quic_mattleun, mhi,
linux-arm-msm, linux-kernel
Cc: zxue, imocanu
In mhi_init_irq_setup, the device pointer used for dev_err
was not initialized. Use the pointer from pci_dev instead.
Signed-off-by: Adam Xue <zxue@semtech.com>
---
drivers/bus/mhi/host/init.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c
index 13e7a55f54ff..93eddf302a49 100644
--- a/drivers/bus/mhi/host/init.c
+++ b/drivers/bus/mhi/host/init.c
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/wait.h>
+#include <linux/pci.h>
#include "internal.h"
#define CREATE_TRACE_POINTS
@@ -194,7 +195,7 @@ void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
{
struct mhi_event *mhi_event = mhi_cntrl->mhi_event;
- struct device *dev = &mhi_cntrl->mhi_dev->dev;
+ struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev);
unsigned long irq_flags = IRQF_SHARED | IRQF_NO_SUSPEND;
int i, ret;
@@ -221,7 +222,7 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
continue;
if (mhi_event->irq >= mhi_cntrl->nr_irqs) {
- dev_err(dev, "irq %d not available for event ring\n",
+ dev_err(&pdev->dev, "irq %d not available for event ring\n",
mhi_event->irq);
ret = -EINVAL;
goto error_request;
@@ -232,7 +233,7 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
irq_flags,
"mhi", mhi_event);
if (ret) {
- dev_err(dev, "Error requesting irq:%d for ev:%d\n",
+ dev_err(&pdev->dev, "Error requesting irq:%d for ev:%d\n",
mhi_cntrl->irq[mhi_event->irq], i);
goto error_request;
}
--
2.43.0
To view our privacy policy, including the types of personal information we collect, process and share, and the rights and options you have in this respect, see www.semtech.com/legal.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] bus: mhi: host: Fix potential kernel panic by calling dev_err
2025-09-02 16:56 [PATCH v1] bus: mhi: host: Fix potential kernel panic by calling dev_err Adam Xue
@ 2025-09-04 9:30 ` Krishna Chaitanya Chundru
0 siblings, 0 replies; 3+ messages in thread
From: Krishna Chaitanya Chundru @ 2025-09-04 9:30 UTC (permalink / raw)
To: Adam Xue, mani, jeff.hugo, quic_yabdulra, chentao, quic_mattleun,
mhi, linux-arm-msm, linux-kernel
Cc: imocanu
On 9/2/2025 10:26 PM, Adam Xue wrote:
> In mhi_init_irq_setup, the device pointer used for dev_err
> was not initialized. Use the pointer from pci_dev instead.
>
> Signed-off-by: Adam Xue <zxue@semtech.com>
> ---
> drivers/bus/mhi/host/init.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c
> index 13e7a55f54ff..93eddf302a49 100644
> --- a/drivers/bus/mhi/host/init.c
> +++ b/drivers/bus/mhi/host/init.c
> @@ -18,6 +18,7 @@
> #include <linux/slab.h>
> #include <linux/vmalloc.h>
> #include <linux/wait.h>
> +#include <linux/pci.h>
> #include "internal.h"
>
> #define CREATE_TRACE_POINTS
> @@ -194,7 +195,7 @@ void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
> int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
> {
> struct mhi_event *mhi_event = mhi_cntrl->mhi_event;
> - struct device *dev = &mhi_cntrl->mhi_dev->dev;
> + struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev);
> unsigned long irq_flags = IRQF_SHARED | IRQF_NO_SUSPEND;
> int i, ret;
>
> @@ -221,7 +222,7 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
> continue;
>
> if (mhi_event->irq >= mhi_cntrl->nr_irqs) {
> - dev_err(dev, "irq %d not available for event ring\n",
> + dev_err(&pdev->dev, "irq %d not available for event ring\n",
> mhi_event->irq);
Don't use pci_dev in mhi as mhi agnostic of the underlying transfer
protocol like PCIe.
Use dev_err(mhi_cntrl->cntrl_dev, here.
- Krishna Chaitanya.
> ret = -EINVAL;
> goto error_request;
> @@ -232,7 +233,7 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
> irq_flags,
> "mhi", mhi_event);
> if (ret) {
> - dev_err(dev, "Error requesting irq:%d for ev:%d\n",
> + dev_err(&pdev->dev, "Error requesting irq:%d for ev:%d\n",
> mhi_cntrl->irq[mhi_event->irq], i);
> goto error_request;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v1] bus: mhi: host: Fix potential kernel panic by calling dev_err
@ 2025-07-23 18:46 Adam Xue
0 siblings, 0 replies; 3+ messages in thread
From: Adam Xue @ 2025-07-23 18:46 UTC (permalink / raw)
To: mani, jeff.hugo, quic_yabdulra, chentao, quic_mattleun, linux-kernel
Cc: zxue, imocanu
In mhi_init_irq_setup, the device pointer used for dev_err
was not initialized. Use the pointer from pci_dev instead.
Signed-off-by: Adam Xue <zxue@semtech.com>
---
drivers/bus/mhi/host/init.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c
index 13e7a55f54ff..93eddf302a49 100644
--- a/drivers/bus/mhi/host/init.c
+++ b/drivers/bus/mhi/host/init.c
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/wait.h>
+#include <linux/pci.h>
#include "internal.h"
#define CREATE_TRACE_POINTS
@@ -194,7 +195,7 @@ void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
{
struct mhi_event *mhi_event = mhi_cntrl->mhi_event;
- struct device *dev = &mhi_cntrl->mhi_dev->dev;
+ struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev);
unsigned long irq_flags = IRQF_SHARED | IRQF_NO_SUSPEND;
int i, ret;
@@ -221,7 +222,7 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
continue;
if (mhi_event->irq >= mhi_cntrl->nr_irqs) {
- dev_err(dev, "irq %d not available for event ring\n",
+ dev_err(&pdev->dev, "irq %d not available for event ring\n",
mhi_event->irq);
ret = -EINVAL;
goto error_request;
@@ -232,7 +233,7 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)
irq_flags,
"mhi", mhi_event);
if (ret) {
- dev_err(dev, "Error requesting irq:%d for ev:%d\n",
+ dev_err(&pdev->dev, "Error requesting irq:%d for ev:%d\n",
mhi_cntrl->irq[mhi_event->irq], i);
goto error_request;
}
--
2.43.0
To view our privacy policy, including the types of personal information we collect, process and share, and the rights and options you have in this respect, see www.semtech.com/legal.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-04 9:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-02 16:56 [PATCH v1] bus: mhi: host: Fix potential kernel panic by calling dev_err Adam Xue
2025-09-04 9:30 ` Krishna Chaitanya Chundru
-- strict thread matches above, loose matches on Subject: below --
2025-07-23 18:46 Adam Xue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®