Skip to contentSkip to conversation

bus: mhi: core: Fix a NULL vs IS_ERR check in mhi_create_devices()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus: mhi: core: Fix a NULL vs IS_ERR check in mhi_create_devices()

The mhi_alloc_device() function never returns NULL, it returns error pointers.

Fixes da1c4f856924 ("bus: mhi: core: Add support for creating and destroying MHI devices")
---
 drivers/bus/mhi/core/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/core/main.c +1 -1
index eb4256b81406..55928feea0c9 100644
@@ -294,7 +294,7 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl)
 		    !(mhi_chan->ee_mask & BIT(mhi_cntrl->ee)))
 			continue;
 		mhi_dev = mhi_alloc_device(mhi_cntrl);
-		if (!mhi_dev)
+		if (IS_ERR(mhi_dev))
 			return;
 
 		mhi_dev->dev_type = MHI_DEVICE_XFER;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

The mhi_alloc_device() function never returns NULL, it returns error pointers.

Fixes da1c4f856924 ("bus: mhi: core: Add support for creating and destroying MHI devices")

Thanks Dan!

Regards,
Mani

Quoted 20 lines
---
 drivers/bus/mhi/core/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/core/main.c +1 -1
index eb4256b81406..55928feea0c9 100644
@@ -294,7 +294,7 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl)
 		    !(mhi_chan->ee_mask & BIT(mhi_cntrl->ee)))
 			continue;
 		mhi_dev = mhi_alloc_device(mhi_cntrl);
-		if (!mhi_dev)
+		if (IS_ERR(mhi_dev))
 			return;
 
 		mhi_dev->dev_type = MHI_DEVICE_XFER;
Signature · 1 line
2.25.1