This patch converts macro tri_cur_buf_mask/shift to function to address the
following issue reported by Coverity:
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: dma_chan * 2 != 63 is always true regardless of
the values of its operands. This occurs as the logical first operand of '?:'.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(reg_num == 14) || (reg_num == 15));
}
+static inline uint32_t tri_cur_buf_mask(uint32_t dma_chan)
+{
+ uint32_t mask = 1UL << ((dma_chan * 2) & 0x1F);
+
+ return mask * 3;
+}
+
+static inline uint32_t tri_cur_buf_shift(uint32_t dma_chan)
+{
+ uint32_t mask = 1UL << ((dma_chan * 2) & 0x1F);
+
+ return ffs(mask) - 1;
+}
+
#define idma_is_valid(ch) (ch != NO_DMA)
#define idma_mask(ch) (idma_is_valid(ch) ? (1UL << (ch & 0x1F)) : 0)
-#define tri_cur_buf_mask(ch) (idma_mask(ch*2) * 3)
-#define tri_cur_buf_shift(ch) (ffs(idma_mask(ch*2)) - 1)
static inline bool idma_is_set(struct ipu_soc *ipu, uint32_t reg, uint32_t dma)
{