Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1699803

Re: [PATCH] Staging: vc04_services: Fix WARN_ON instead of BUG_ON

From Stefan Wahren <stefan.wahren@i2se.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Staging: vc04_services: Fix WARN_ON instead of BUG_ON
Date 2017-07-31 10:20 +0200
Message-ID <u9e5I-3R2-9@gated-at.bofh.it> (permalink)
References <u9d9E-3ia-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Am 31.07.2017 um 09:14 schrieb janani-sankarababu:
> This patch is to replace the use of BUG_ON macro with WARN_ON
> inorder to prevent the crashing of the kernel.

Unfortunately it isn't always that simple. checkpatch isn't smart. It's
preferred to handle error cases instead of flooding the kernel log.

>
> Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>
> ---
>  drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> index f484bb0..30bc246 100644
> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
> @@ -91,7 +91,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol,
>  	if (mutex_lock_interruptible(&chip->audio_mutex))
>  		return -EINTR;
>  
> -	BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
> +	WARN_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));

The complete logic seems strange to me and the statement before didn't
even check for chip.

Regards
Stefan

>  
>  	if (kcontrol->private_value == PCM_PLAYBACK_VOLUME)
>  		ucontrol->value.integer.value[0] = chip2alsa(chip->volume);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] Staging: vc04_services: Fix WARN_ON instead of BUG_ON janani-sankarababu <jananis37@gmail.com> - 2017-07-31 09:20 +0200
  Re: [PATCH] Staging: vc04_services: Fix WARN_ON instead of BUG_ON Stefan Wahren <stefan.wahren@i2se.com> - 2017-07-31 10:20 +0200
  Re: [PATCH] Staging: vc04_services: Fix WARN_ON instead of BUG_ON Dan Carpenter <dan.carpenter@oracle.com> - 2017-07-31 10:50 +0200

csiph-web