[alsa-devel] [PATCH 0/3] ASoC: Kill BUG_ON() usages
Hi,
I found a few stupid BUG_ON() usages in the code, let's kill or replace them.
Takashi
===
Takashi Iwai (3): ASoC: tas571x: Kill BUG_ON() usage ASoC: davinci: Kill BUG_ON() usage ASoC: intel: Kill BUG_ON() usage
sound/soc/codecs/tas571x.c | 3 ++- sound/soc/davinci/davinci-mcasp.c | 3 ++- sound/soc/intel/atom/sst/sst_loader.c | 1 - sound/soc/intel/atom/sst/sst_stream.c | 1 - 4 files changed, 4 insertions(+), 4 deletions(-)
Don't use BUG_ON() for a non-critical sanity check on production systems. This patch replaces with a softer WARN_ON() and an error path.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/codecs/tas571x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index 810369f687d7..a09499977be4 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -697,7 +697,8 @@ static int tas571x_i2c_probe(struct i2c_client *client, return PTR_ERR(priv->mclk); }
- BUG_ON(priv->chip->num_supply_names > TAS571X_MAX_SUPPLIES); + if (WARN_ON(priv->chip->num_supply_names > TAS571X_MAX_SUPPLIES)) + return -EINVAL; for (i = 0; i < priv->chip->num_supply_names; i++) priv->supplies[i].supply = priv->chip->supply_names[i];
The patch
ASoC: tas571x: Kill BUG_ON() usage
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From a029ef45179d72945c7ae0a11f97e8012a5574ac Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Thu, 7 Sep 2017 10:59:16 +0200 Subject: [PATCH] ASoC: tas571x: Kill BUG_ON() usage
Don't use BUG_ON() for a non-critical sanity check on production systems. This patch replaces with a softer WARN_ON() and an error path.
Signed-off-by: Takashi Iwai tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/tas571x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index 810369f687d7..a09499977be4 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -697,7 +697,8 @@ static int tas571x_i2c_probe(struct i2c_client *client, return PTR_ERR(priv->mclk); }
- BUG_ON(priv->chip->num_supply_names > TAS571X_MAX_SUPPLIES); + if (WARN_ON(priv->chip->num_supply_names > TAS571X_MAX_SUPPLIES)) + return -EINVAL; for (i = 0; i < priv->chip->num_supply_names; i++) priv->supplies[i].supply = priv->chip->supply_names[i];
Don't use BUG_ON() for a non-critical sanity check on production systems. This patch replaces with a softer WARN_ON() and an error path.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/davinci/davinci-mcasp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index f395bbc7c354..8372ecd1d1e9 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1721,7 +1721,8 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp) PTR_ERR(chan)); return PTR_ERR(chan); } - BUG_ON(!chan->device || !chan->device->dev); + if (WARN_ON(!chan->device || !chan->device->dev)) + return -EINVAL;
if (chan->device->dev->of_node) ret = of_property_read_string(chan->device->dev->of_node,
The patch
ASoC: davinci: Kill BUG_ON() usage
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From befff4fbc27e19b14b343eb4a65d8f75d38b6230 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Thu, 7 Sep 2017 10:59:17 +0200 Subject: [PATCH] ASoC: davinci: Kill BUG_ON() usage
Don't use BUG_ON() for a non-critical sanity check on production systems. This patch replaces with a softer WARN_ON() and an error path.
Signed-off-by: Takashi Iwai tiwai@suse.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/davinci/davinci-mcasp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 23b0da7df1f2..40be08cecea4 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -1721,7 +1721,8 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp) PTR_ERR(chan)); return PTR_ERR(chan); } - BUG_ON(!chan->device || !chan->device->dev); + if (WARN_ON(!chan->device || !chan->device->dev)) + return -EINVAL;
if (chan->device->dev->of_node) ret = of_property_read_string(chan->device->dev->of_node,
Don't use BUG_ON() for a non-critical sanity check on production systems. This patch either removes useless BUG_ON() calls.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/soc/intel/atom/sst/sst_loader.c | 1 - sound/soc/intel/atom/sst/sst_stream.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/sound/soc/intel/atom/sst/sst_loader.c b/sound/soc/intel/atom/sst/sst_loader.c index 33917146d9c4..a686eef2cf7f 100644 --- a/sound/soc/intel/atom/sst/sst_loader.c +++ b/sound/soc/intel/atom/sst/sst_loader.c @@ -415,7 +415,6 @@ int sst_load_fw(struct intel_sst_drv *sst_drv_ctx) return ret_val; }
- BUG_ON(!sst_drv_ctx->fw_in_mem); block = sst_create_block(sst_drv_ctx, 0, FW_DWNL_ID); if (block == NULL) return -ENOMEM; diff --git a/sound/soc/intel/atom/sst/sst_stream.c b/sound/soc/intel/atom/sst/sst_stream.c index 83d8dda15233..65e257b17a7e 100644 --- a/sound/soc/intel/atom/sst/sst_stream.c +++ b/sound/soc/intel/atom/sst/sst_stream.c @@ -45,7 +45,6 @@ int sst_alloc_stream_mrfld(struct intel_sst_drv *sst_drv_ctx, void *params) void *data = NULL;
dev_dbg(sst_drv_ctx->dev, "Enter\n"); - BUG_ON(!params);
str_params = (struct snd_sst_params *)params; memset(&alloc_param, 0, sizeof(alloc_param));
On Thu, Sep 07, 2017 at 10:59:18AM +0200, Takashi Iwai wrote:
Don't use BUG_ON() for a non-critical sanity check on production systems. This patch either removes useless BUG_ON() calls.
Acked-By: Vinod Koul vinod.koul@intel.com
Signed-off-by: Takashi Iwai tiwai@suse.de
sound/soc/intel/atom/sst/sst_loader.c | 1 - sound/soc/intel/atom/sst/sst_stream.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/sound/soc/intel/atom/sst/sst_loader.c b/sound/soc/intel/atom/sst/sst_loader.c index 33917146d9c4..a686eef2cf7f 100644 --- a/sound/soc/intel/atom/sst/sst_loader.c +++ b/sound/soc/intel/atom/sst/sst_loader.c @@ -415,7 +415,6 @@ int sst_load_fw(struct intel_sst_drv *sst_drv_ctx) return ret_val; }
- BUG_ON(!sst_drv_ctx->fw_in_mem); block = sst_create_block(sst_drv_ctx, 0, FW_DWNL_ID); if (block == NULL) return -ENOMEM;
diff --git a/sound/soc/intel/atom/sst/sst_stream.c b/sound/soc/intel/atom/sst/sst_stream.c index 83d8dda15233..65e257b17a7e 100644 --- a/sound/soc/intel/atom/sst/sst_stream.c +++ b/sound/soc/intel/atom/sst/sst_stream.c @@ -45,7 +45,6 @@ int sst_alloc_stream_mrfld(struct intel_sst_drv *sst_drv_ctx, void *params) void *data = NULL;
dev_dbg(sst_drv_ctx->dev, "Enter\n");
BUG_ON(!params);
str_params = (struct snd_sst_params *)params; memset(&alloc_param, 0, sizeof(alloc_param));
-- 2.14.1
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
The patch
ASoC: intel: Kill BUG_ON() usage
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 89db6f9632e38b6b5cc7f23f4b67f74470319978 Mon Sep 17 00:00:00 2001
From: Takashi Iwai tiwai@suse.de Date: Thu, 7 Sep 2017 10:59:18 +0200 Subject: [PATCH] ASoC: intel: Kill BUG_ON() usage
Don't use BUG_ON() for a non-critical sanity check on production systems. This patch either removes useless BUG_ON() calls.
Signed-off-by: Takashi Iwai tiwai@suse.de Acked-By: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/atom/sst/sst_loader.c | 1 - sound/soc/intel/atom/sst/sst_stream.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/sound/soc/intel/atom/sst/sst_loader.c b/sound/soc/intel/atom/sst/sst_loader.c index 33917146d9c4..a686eef2cf7f 100644 --- a/sound/soc/intel/atom/sst/sst_loader.c +++ b/sound/soc/intel/atom/sst/sst_loader.c @@ -415,7 +415,6 @@ int sst_load_fw(struct intel_sst_drv *sst_drv_ctx) return ret_val; }
- BUG_ON(!sst_drv_ctx->fw_in_mem); block = sst_create_block(sst_drv_ctx, 0, FW_DWNL_ID); if (block == NULL) return -ENOMEM; diff --git a/sound/soc/intel/atom/sst/sst_stream.c b/sound/soc/intel/atom/sst/sst_stream.c index 83d8dda15233..65e257b17a7e 100644 --- a/sound/soc/intel/atom/sst/sst_stream.c +++ b/sound/soc/intel/atom/sst/sst_stream.c @@ -45,7 +45,6 @@ int sst_alloc_stream_mrfld(struct intel_sst_drv *sst_drv_ctx, void *params) void *data = NULL;
dev_dbg(sst_drv_ctx->dev, "Enter\n"); - BUG_ON(!params);
str_params = (struct snd_sst_params *)params; memset(&alloc_param, 0, sizeof(alloc_param));
participants (3)
-
Mark Brown
-
Takashi Iwai
-
Vinod Koul