Skip to contentSkip to conversation

Fix potential kernel panic by calling dev_err

PATCH Superseded Adam Xue 3 participants 5 messages Sep 4, 2025 – Sep 5, 2025

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Adam Xue

author
#0 lore raw

PATCH v3 1/1 Fix potential kernel panic by calling dev_err

In mhi_init_irq_setup, the device pointer used for dev_err was not initialized.
Use the pointer from mhi_cntrl instead.

---
 drivers/bus/mhi/host/init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/mhi/host/init.c +2 -3
index 7f72aab38ce9..099be8dd1900 100644
@@ -194,7 +194,6 @@ static void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
 static 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;
 	unsigned long irq_flags = IRQF_SHARED | IRQF_NO_SUSPEND;
 	int i, ret;
 
@@ -221,7 +220,7 @@ static 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(mhi_cntrl->cntrl_dev, "irq %d not available for event ring\n",
 				mhi_event->irq);
 			ret = -EINVAL;
 			goto error_request;
@@ -232,7 +231,7 @@ static 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(mhi_cntrl->cntrl_dev, "Error requesting irq:%d for ev:%d\n",
 				mhi_cntrl->irq[mhi_event->irq], i);
 			goto error_request;
 		}
Signature · 4 lines
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.
Reviewed-by on v3 1/1
#1 lore raw
Quoted 3 lines · Adam Xue

In mhi_init_irq_setup, the device pointer used for dev_err was not initialized.
Use the pointer from mhi_cntrl instead.

Don't we need fixes tag.

Quoted 1 line
Quoted 34 lines
---
  drivers/bus/mhi/host/init.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/mhi/host/init.c +2 -3
index 7f72aab38ce9..099be8dd1900 100644
@@ -194,7 +194,6 @@ static void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
  static 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;
  	unsigned long irq_flags = IRQF_SHARED | IRQF_NO_SUSPEND;
  	int i, ret;
 
@@ -221,7 +220,7 @@ static 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(mhi_cntrl->cntrl_dev, "irq %d not available for event ring\n",
  				mhi_event->irq);
  			ret = -EINVAL;
  			goto error_request;
@@ -232,7 +231,7 @@ static 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(mhi_cntrl->cntrl_dev, "Error requesting irq:%d for ev:%d\n",
  				mhi_cntrl->irq[mhi_event->irq], i);
  			goto error_request;
  		}
#2 lore raw
In reply to Adam Xue

On Thu, Sep 04, 2025 at 11:34:05AM GMT, Adam Xue wrote:

Missing subject prefix:

bus: mhi: host:

Quoted 3 lines

In mhi_init_irq_setup, the device pointer used for dev_err was not initialized.
Use the pointer from mhi_cntrl instead.

You need to add relevant fixes tag and CC stable list. Below tags are valid for this fix:

Fixes b0fc0167f254 ("bus: mhi: core: Allow shared IRQ for event rings")
Fixes 3000f85b8f47 ("bus: mhi: core: Add support for basic PM operations")

- Mani

Quoted 40 lines
---
 drivers/bus/mhi/host/init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/mhi/host/init.c +2 -3
index 7f72aab38ce9..099be8dd1900 100644
@@ -194,7 +194,6 @@ static void mhi_deinit_free_irq(struct mhi_controller *mhi_cntrl)
 static 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;
 	unsigned long irq_flags = IRQF_SHARED | IRQF_NO_SUSPEND;
 	int i, ret;
 
@@ -221,7 +220,7 @@ static 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(mhi_cntrl->cntrl_dev, "irq %d not available for event ring\n",
 				mhi_event->irq);
 			ret = -EINVAL;
 			goto error_request;
@@ -232,7 +231,7 @@ static 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(mhi_cntrl->cntrl_dev, "Error requesting irq:%d for ev:%d\n",
 				mhi_cntrl->irq[mhi_event->irq], i);
 			goto error_request;
 		}
Signature · 4 lines
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.
Signature · 1 line
மணிவண்ணன் சதாசிவம்
author
#3 lore raw

Hi Mani,

Thanks for reviewing the patch. I am still learning the patch submission process. I got the email addresses from ./scripts/get_maintainer.pl. Where may I get the stable list?

Regards,

Adam

-----Original Message-----
From: Manivannan Sadhasivam <[email protected]>
Sent: September 5, 2025 9:45 AM
To: Adam Xue <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Iulian Mocanu <[email protected]>
Subject: Re: [PATCH v3] Fix potential kernel panic by calling dev_err

Caution: This email originated outside of Semtech.

On Thu, Sep 04, 2025 at 11:34:05AM GMT, Adam Xue wrote:

Missing subject prefix:

bus: mhi: host:

Quoted 3 lines

In mhi_init_irq_setup, the device pointer used for dev_err was not initialized.
Use the pointer from mhi_cntrl instead.

You need to add relevant fixes tag and CC stable list. Below tags are valid for this fix:

Fixes b0fc0167f254 ("bus: mhi: core: Allow shared IRQ for event rings")
Fixes 3000f85b8f47 ("bus: mhi: core: Add support for basic PM operations")

- Mani

Quoted 41 lines
---
 drivers/bus/mhi/host/init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/mhi/host/init.c +0 -0
index 7f72aab38ce9..099be8dd1900 100644
@@ -194,7 +194,6 @@ static void mhi_deinit_free_irq(struct 

mhi_controller *mhi_cntrl) static int mhi_init_irq_setup(struct

mhi_controller *mhi_cntrl)  {
      struct mhi_event *mhi_event = mhi_cntrl->mhi_event;
drivers/bus/mhi/host/init.c +2 -2
-     struct device *dev = &mhi_cntrl->mhi_dev->dev;
      unsigned long irq_flags = IRQF_SHARED | IRQF_NO_SUSPEND;
      int i, ret;
@@ -221,7 +220,7 @@ static 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(mhi_cntrl->cntrl_dev, "irq %d not 
+ available for event ring\n",
                              mhi_event->irq);
                      ret = -EINVAL;
                      goto error_request; @@ -232,7 +231,7 @@ static 

int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)

                                irq_flags,
                                "mhi", mhi_event);
              if (ret) {
drivers/bus/mhi/host/init.c +2 -2
-                     dev_err(dev, "Error requesting irq:%d for ev:%d\n",
+                     dev_err(mhi_cntrl->cntrl_dev, "Error requesting 
+ irq:%d for ev:%d\n",
                              mhi_cntrl->irq[mhi_event->irq], i);
                      goto error_request;
              }
--

2.43.0

Quoted 1 line

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.

--
மணிவண்ணன் சதாசிவம்

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.

#4 lore raw
Quoted 5 lines · Adam Xue

Hi Mani,

Thanks for reviewing the patch. I am still learning the patch submission process. I got the email addresses from ./scripts/get_maintainer.pl. Where may I get the stable list?

Refer the past commits:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/bus/mhi?id=5bd398e20f0833ae8a1267d4f343591a2dd20185

For bug fixes that needs to be backported to stable kernels, you need to specify the below tag:

- Mani

Quoted 78 lines

Regards,

Adam

-----Original Message-----
From: Manivannan Sadhasivam <[email protected]>
Sent: September 5, 2025 9:45 AM
To: Adam Xue <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Iulian Mocanu <[email protected]>
Subject: Re: [PATCH v3] Fix potential kernel panic by calling dev_err

Caution: This email originated outside of Semtech.

On Thu, Sep 04, 2025 at 11:34:05AM GMT, Adam Xue wrote:

Missing subject prefix:

bus: mhi: host:

Quoted 3 lines

In mhi_init_irq_setup, the device pointer used for dev_err was not initialized.
Use the pointer from mhi_cntrl instead.

You need to add relevant fixes tag and CC stable list. Below tags are valid for this fix:

Fixes b0fc0167f254 ("bus: mhi: core: Allow shared IRQ for event rings")
Fixes 3000f85b8f47 ("bus: mhi: core: Add support for basic PM operations")

- Mani

Quoted 41 lines
---
 drivers/bus/mhi/host/init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/bus/mhi/host/init.c +0 -0
index 7f72aab38ce9..099be8dd1900 100644
@@ -194,7 +194,6 @@ static void mhi_deinit_free_irq(struct 

mhi_controller *mhi_cntrl) static int mhi_init_irq_setup(struct

mhi_controller *mhi_cntrl)  {
      struct mhi_event *mhi_event = mhi_cntrl->mhi_event;
drivers/bus/mhi/host/init.c +2 -2
-     struct device *dev = &mhi_cntrl->mhi_dev->dev;
      unsigned long irq_flags = IRQF_SHARED | IRQF_NO_SUSPEND;
      int i, ret;
@@ -221,7 +220,7 @@ static 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(mhi_cntrl->cntrl_dev, "irq %d not 
+ available for event ring\n",
                              mhi_event->irq);
                      ret = -EINVAL;
                      goto error_request; @@ -232,7 +231,7 @@ static 

int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl)

                                irq_flags,
                                "mhi", mhi_event);
              if (ret) {
drivers/bus/mhi/host/init.c +2 -2
-                     dev_err(dev, "Error requesting irq:%d for ev:%d\n",
+                     dev_err(mhi_cntrl->cntrl_dev, "Error requesting 
+ irq:%d for ev:%d\n",
                              mhi_cntrl->irq[mhi_event->irq], i);
                      goto error_request;
              }
--

2.43.0

Quoted 1 line

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.

--
மணிவண்ணன் சதாசிவம்

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.

Signature · 1 line
மணிவண்ணன் சதாசிவம்