[PATCH master 3/7] net: fec_mpc5200: fix false positive -Wmisleading-indentation
Ahmad Fatoum
a.fatoum at pengutronix.de
Sun Jun 4 23:29:35 PDT 2023
After the preprocessor runs, the code in question looks like this:
SDMA_INT_DISABLE
while ((counter--) && (!(fec->eth->ievent & FEC_IEVENT_GRA)));
{
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA;
sdma->IntMask |= (1 << tasknum);
}
Which understandably looks like a bug. Avoid this by using do { } while
(0) and moving the semicolon to a separate line.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
arch/powerpc/mach-mpc5xxx/include/mach/sdma.h | 25 ++++++++-----------
drivers/net/fec_mpc5200.c | 3 ++-
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/mach-mpc5xxx/include/mach/sdma.h b/arch/powerpc/mach-mpc5xxx/include/mach/sdma.h
index 02f561675a03..176ed3e892e2 100644
--- a/arch/powerpc/mach-mpc5xxx/include/mach/sdma.h
+++ b/arch/powerpc/mach-mpc5xxx/include/mach/sdma.h
@@ -49,40 +49,35 @@ ALL PARAMETERS ARE ALL LONGWORDS (FOUR BYTES EACH).
/*---------------------------------------------------------------------*/
/* Disable SmartDMA task */
-#define SDMA_TASK_DISABLE(tasknum) \
-{ \
+#define SDMA_TASK_DISABLE(tasknum) do { \
volatile ushort *tcr = (ushort *)(MPC5XXX_SDMA + 0x0000001c + 2 * tasknum); \
*tcr = (*tcr) & (~0x8000); \
-}
+} while (0)
/* Enable SmartDMA task */
-#define SDMA_TASK_ENABLE(tasknum) \
-{ \
+#define SDMA_TASK_ENABLE(tasknum) do { \
volatile ushort *tcr = (ushort *) (MPC5XXX_SDMA + 0x0000001c + 2 * tasknum); \
*tcr = (*tcr) | 0x8000; \
-}
+} while (0)
/* Enable interrupt */
-#define SDMA_INT_ENABLE(tasknum) \
-{ \
+#define SDMA_INT_ENABLE(tasknum) do { \
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
sdma->IntMask &= ~(1 << tasknum); \
-}
+} while (0)
/* Disable interrupt */
-#define SDMA_INT_DISABLE(tasknum) \
-{ \
+#define SDMA_INT_DISABLE(tasknum) do { \
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
sdma->IntMask |= (1 << tasknum); \
-}
+} while (0)
/* Clear interrupt pending bits */
-#define SDMA_CLEAR_IEVENT(tasknum) \
-{ \
+#define SDMA_CLEAR_IEVENT(tasknum) do { \
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA; \
sdma->IntPend = (1 << tasknum); \
-}
+} while (0)
/* get interrupt pending bit of a task */
#define SDMA_GET_PENDINGBIT(tasknum) \
diff --git a/drivers/net/fec_mpc5200.c b/drivers/net/fec_mpc5200.c
index 53b5a861aeb8..9c9b795f140c 100644
--- a/drivers/net/fec_mpc5200.c
+++ b/drivers/net/fec_mpc5200.c
@@ -420,7 +420,8 @@ static void mpc5xxx_fec_halt(struct eth_device *dev)
/*
* wait for graceful stop to register
*/
- while ((counter--) && (!(fec->eth->ievent & FEC_IEVENT_GRA))) ;
+ while ((counter--) && (!(fec->eth->ievent & FEC_IEVENT_GRA)))
+ ;
/*
* Disable SmartDMA tasks
--
2.39.2
More information about the barebox
mailing list