Skip to content

Commit 192a16a

Browse files
Dan CarpenterJassi Brar
authored andcommitted
mailbox: arm_mhuv2: clean up loop in get_irq_chan_comb()
Both the inner and outer loops in this code use the "i" iterator. The inner loop should really use a different iterator. It doesn't affect things in practice because the data comes from the device tree. The "protocol" and "windows" variables are going to be zero. That means we're always going to hit the "return &chans[channel];" statement and we're not going to want to iterate through the outer loop again. Still it's worth fixing this for future use cases. Fixes: 5a6338c ("mailbox: arm_mhuv2: Add driver") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
1 parent 98fc87f commit 192a16a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/mailbox/arm_mhuv2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static const struct mhuv2_protocol_ops mhuv2_data_transfer_ops = {
500500
static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 __iomem *reg)
501501
{
502502
struct mbox_chan *chans = mhu->mbox.chans;
503-
int channel = 0, i, offset = 0, windows, protocol, ch_wn;
503+
int channel = 0, i, j, offset = 0, windows, protocol, ch_wn;
504504
u32 stat;
505505

506506
for (i = 0; i < MHUV2_CMB_INT_ST_REG_CNT; i++) {
@@ -510,9 +510,9 @@ static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 __iomem *reg)
510510

511511
ch_wn = i * MHUV2_STAT_BITS + __builtin_ctz(stat);
512512

513-
for (i = 0; i < mhu->length; i += 2) {
514-
protocol = mhu->protocols[i];
515-
windows = mhu->protocols[i + 1];
513+
for (j = 0; j < mhu->length; j += 2) {
514+
protocol = mhu->protocols[j];
515+
windows = mhu->protocols[j + 1];
516516

517517
if (ch_wn >= offset + windows) {
518518
if (protocol == DOORBELL)

0 commit comments

Comments
 (0)