From: Takashi Iwai Date: Tue, 5 Nov 2013 14:00:02 +0000 (+0100) Subject: ALSA: ctxfi: Use WARN_ON() instead of BUG_ON() X-Git-Tag: accepted/tizen/common/20141203.182822~1038^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=29fa9578046ea51e9cf97c4e16207ea6ec375084;p=platform%2Fkernel%2Flinux-arm64.git ALSA: ctxfi: Use WARN_ON() instead of BUG_ON() BUG_ON() is rather useless for debugging as it leads to panic(). Use WARN_ON() and handle the error cases accordingly. Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/ctxfi/cthardware.c b/sound/pci/ctxfi/cthardware.c index 110b8ac..a689f25 100644 --- a/sound/pci/ctxfi/cthardware.c +++ b/sound/pci/ctxfi/cthardware.c @@ -69,7 +69,8 @@ unsigned int get_field(unsigned int data, unsigned int field) { int i; - BUG_ON(!field); + if (WARN_ON(!field)) + return 0; /* @field should always be greater than 0 */ for (i = 0; !(field & (1 << i)); ) i++; @@ -81,7 +82,8 @@ void set_field(unsigned int *data, unsigned int field, unsigned int value) { int i; - BUG_ON(!field); + if (WARN_ON(!field)) + return; /* @field should always be greater than 0 */ for (i = 0; !(field & (1 << i)); ) i++;