Skip to contentSkip to conversation

ASSERT() -> BUG_ON() (1/4): arch/parisc/kernel/pci-dma.c

parisc-linux Grant Grundler 1 participant 1 message Nov 7, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 2 lines · Joel Soete

This is a very first proposal because:
a) BUG_ON() is not anymore conditional

Exactly, this is exactly why I'm not enthusiastic about replacing ASSERT with BUG_ON. ASSERT is intended to catch developement bugs that I know will not occur in production. Having the BUG_ON will only slow down the production kernel in those cases.

So some BUG_ON are ok, but not a wholesale replacement of ASSERTs. I'll apply the patch and then delete BUG_ON that I don't think we need.

Quoted 11 lines

b) I would like to change a bit such:
[...]

	BUG_ON(pages_mapped == 0);
	BUG_ON((pages_mapped * PAGE_SIZE) >= DMA_CHUNK_SIZE);
	BUG_ON(pages_mapped >= (BITS_PER_LONG - PAGE_SHIFT));
[...]
into
	BUG_ON((pages_mapped == 0) || \
		((pages_mapped * PAGE_SIZE) >= DMA_CHUNK_SIZE) || \
		(pages_mapped >= (BITS_PER_LONG - PAGE_SHIFT));

[...]

Please don't do this.
Then we won't know which part of the condition failed.

thanks,
grant
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux