Skip to contentSkip to conversation

irq-gic: use BUG_ON instead of if()/BUG

PATCH Maninder Singh 1 participant 1 message Jun 22, 2015

lore
Share & tools
lore
#0 lore raw

Hi Thomas,

Thanks For your suggestions.

Quoted 4 lines
Quoted 4 lines

Further, while we are at that. It would be even more useful to analyze whether the BUG_ON() is needed in the first place or at least could be made conditional on some debug option.

Quoted 8 lines
Quoted 4 lines

But that's not done by the script either, right?

Yes coccinelle semantic patches did not do that changes.
we have to choose whether to make BUG_ON conditional on some debug options.

Right, and that's what I'm asking for. IOW, instead of blindly running scripts at least ask the question whether this stuff needs to be there unconditionally....

And I checked for these if()/BUG, I think we don't even need these if()/BUG constructs in codes. For below 4 functions.
1. gic_dist_save
2. gic_dist_restore
3. gic_cpu_save
4. gic_cpu_restore

As we are checking in loop for (i = 0; i < MAX_GIC_NR; i++)
and passing i as gic_nr. So below condition never returns true for any case, i think
if (gic_nr >= MAX_GIC_NR).

So we can remove if/BUG constructs from these functions ??

5. gic_migrate_target
And also in gic_migrate_target , we initializing gic_nr = 0; and then checking whether gic_nr >= MAX_GIC_NR.

6. gic_cascade_irq
Before calling this function we have checked the same condition in gic_init_bases

So we can also remove if()/BUG from these functions also ?

Thanks ,
Maninder ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠsåy«­æ�¶…­†ÛiÿÿðÃí»è®å’i