All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bus: mhi: ep: Fix signedness bug in mhi_ep_register_controller()
@ 2022-03-07 14:28 Dan Carpenter
  2022-03-07 14:50 ` Alex Elder
  2022-03-07 15:09 ` Manivannan Sadhasivam
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-03-07 14:28 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Hemant Kumar, Alex Elder, mhi, linux-arm-msm, kernel-janitors

The "mhi_cntrl->index" variable is unsigned so the error handling will
not work.

Fixes: 10f0ab9c6787 ("bus: mhi: ep: Add support for registering MHI endpoint controllers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/bus/mhi/ep/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
index 3e98107f08c4..879071b021d5 100644
--- a/drivers/bus/mhi/ep/main.c
+++ b/drivers/bus/mhi/ep/main.c
@@ -1418,11 +1418,10 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,
 	mhi_ep_mmio_set_env(mhi_cntrl, MHI_EE_AMSS);
 
 	/* Set controller index */
-	mhi_cntrl->index = ida_alloc(&mhi_ep_cntrl_ida, GFP_KERNEL);
-	if (mhi_cntrl->index < 0) {
-		ret = mhi_cntrl->index;
+	ret = ida_alloc(&mhi_ep_cntrl_ida, GFP_KERNEL);
+	if (ret < 0)
 		goto err_destroy_wq;
-	}
+	mhi_cntrl->index = ret;
 
 	irq_set_status_flags(mhi_cntrl->irq, IRQ_NOAUTOEN);
 	ret = request_irq(mhi_cntrl->irq, mhi_ep_irq, IRQF_TRIGGER_HIGH,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-07 15:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-07 14:28 [PATCH] bus: mhi: ep: Fix signedness bug in mhi_ep_register_controller() Dan Carpenter
2022-03-07 14:50 ` Alex Elder
2022-03-07 14:53   ` Dan Carpenter
2022-03-07 15:09 ` Manivannan Sadhasivam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.