* [PATCH] media: rzg2l-cru: fix a test for timeout
@ 2022-11-29 9:44 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-11-29 9:44 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Lad Prabhakar
Cc: Sakari Ailus, linux-media, kernel-janitors
The test for if the loop timed out is wrong and Smatch complains:
drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c:411 rzg2l_csi2_mipi_link_disable()
warn: should this be 'timeout == -1'
Let's change it to a preop loop instead of a post op loop.
Fixes: 51e8415e39a9 ("media: platform: Add Renesas RZ/G2L MIPI CSI-2 receiver driver")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
This does change the number of iterations from 20 to 19 but generally
retry counts are approximations.
drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
index aa752b80574c..1bc27aec0265 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c
@@ -402,7 +402,7 @@ static void rzg2l_csi2_mipi_link_disable(struct rzg2l_csi2 *csi2)
rzg2l_csi2_write(csi2, CSI2nRTCT, CSI2nRTCT_VSRST);
/* Make sure CSI2nRTST.VSRSTS bit is cleared */
- while (timeout--) {
+ while (--timeout) {
if (!(rzg2l_csi2_read(csi2, CSI2nRTST) & CSI2nRTST_VSRSTS))
break;
usleep_range(100, 200);
--
2.35.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-29 9:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-29 9:44 [PATCH] media: rzg2l-cru: fix a test for timeout Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox