[PATCH] bus: mhi: ep: Test for non-zero return value where applicable

From: Manivannan Sadhasivam

Date: Mon Mar 02 2026 - 00:54:38 EST


Instead of testing for negative error code, just test for non-zero return
for cases where there is no positive return value. This helps to maintain
code uniformity.

No functional change.

Reported-by: Bjorn Helgaas <helgaas@xxxxxxxxxx>
Closes: https://lore.kernel.org/linux-pci/20260227191510.GA3904799@bhelgaas
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
---
drivers/bus/mhi/ep/main.c | 10 +++++-----
drivers/bus/mhi/ep/ring.c | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
index e3d0a3cbaf94..0277e1ab1198 100644
--- a/drivers/bus/mhi/ep/main.c
+++ b/drivers/bus/mhi/ep/main.c
@@ -367,7 +367,7 @@ static void mhi_ep_read_completion(struct mhi_ep_buf_info *buf_info)
ret = mhi_ep_send_completion_event(mhi_cntrl, ring, el,
MHI_TRE_DATA_GET_LEN(el),
MHI_EV_CC_EOB);
- if (ret < 0) {
+ if (ret) {
dev_err(&mhi_chan->mhi_dev->dev,
"Error sending transfer compl. event\n");
goto err_free_tre_buf;
@@ -383,7 +383,7 @@ static void mhi_ep_read_completion(struct mhi_ep_buf_info *buf_info)
ret = mhi_ep_send_completion_event(mhi_cntrl, ring, el,
MHI_TRE_DATA_GET_LEN(el),
MHI_EV_CC_EOT);
- if (ret < 0) {
+ if (ret) {
dev_err(&mhi_chan->mhi_dev->dev,
"Error sending transfer compl. event\n");
goto err_free_tre_buf;
@@ -449,7 +449,7 @@ static int mhi_ep_read_channel(struct mhi_ep_cntrl *mhi_cntrl,

dev_dbg(dev, "Reading %zd bytes from channel (%u)\n", tr_len, ring->ch_id);
ret = mhi_cntrl->read_async(mhi_cntrl, &buf_info);
- if (ret < 0) {
+ if (ret) {
dev_err(&mhi_chan->mhi_dev->dev, "Error reading from channel\n");
goto err_free_buf_addr;
}
@@ -494,7 +494,7 @@ static int mhi_ep_process_ch_ring(struct mhi_ep_ring *ring)
} else {
/* UL channel */
ret = mhi_ep_read_channel(mhi_cntrl, ring);
- if (ret < 0) {
+ if (ret) {
dev_err(&mhi_chan->mhi_dev->dev, "Failed to read channel\n");
return ret;
}
@@ -591,7 +591,7 @@ int mhi_ep_queue_skb(struct mhi_ep_device *mhi_dev, struct sk_buff *skb)

dev_dbg(dev, "Writing %zd bytes to channel (%u)\n", tr_len, ring->ch_id);
ret = mhi_cntrl->write_async(mhi_cntrl, &buf_info);
- if (ret < 0) {
+ if (ret) {
dev_err(dev, "Error writing to the channel\n");
goto err_exit;
}
diff --git a/drivers/bus/mhi/ep/ring.c b/drivers/bus/mhi/ep/ring.c
index 9375b16ff2a5..405ce16c02a8 100644
--- a/drivers/bus/mhi/ep/ring.c
+++ b/drivers/bus/mhi/ep/ring.c
@@ -49,7 +49,7 @@ static int __mhi_ep_cache_ring(struct mhi_ep_ring *ring, size_t end)
buf_info.dev_addr = &ring->ring_cache[start];

ret = mhi_cntrl->read_sync(mhi_cntrl, &buf_info);
- if (ret < 0)
+ if (ret)
return ret;
} else {
buf_info.size = (ring->ring_size - start) * sizeof(struct mhi_ring_element);
@@ -57,7 +57,7 @@ static int __mhi_ep_cache_ring(struct mhi_ep_ring *ring, size_t end)
buf_info.dev_addr = &ring->ring_cache[start];

ret = mhi_cntrl->read_sync(mhi_cntrl, &buf_info);
- if (ret < 0)
+ if (ret)
return ret;

if (end) {
@@ -66,7 +66,7 @@ static int __mhi_ep_cache_ring(struct mhi_ep_ring *ring, size_t end)
buf_info.size = end * sizeof(struct mhi_ring_element);

ret = mhi_cntrl->read_sync(mhi_cntrl, &buf_info);
- if (ret < 0)
+ if (ret)
return ret;
}
}
--
2.51.0