diff mbox series

[1/5] ASOC: SOF: Intel: hda-codec: move unused label to correct position

Message ID 20200813175839.59422-2-pierre-louis.bossart@linux.intel.com (mailing list archive)
State Accepted
Commit 11ec0edc6408a739dffca34ebbbe921817c3b10e
Headers show
Series ASoC: SOF/Intel: fix cppcheck warnings | expand

Commit Message

Pierre-Louis Bossart Aug. 13, 2020, 5:58 p.m. UTC
Cppcheck reports the following warning:

sound/soc/sof/intel/hda-codec.c:191:1: style: Label 'error' is not
used. [unusedLabel]

This label is indeed only used conditionally, move it where it's
actually used.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-codec.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Nathan Chancellor Aug. 23, 2020, 3:48 a.m. UTC | #1
On Thu, Aug 13, 2020 at 12:58:35PM -0500, Pierre-Louis Bossart wrote:
> Cppcheck reports the following warning:
> 
> sound/soc/sof/intel/hda-codec.c:191:1: style: Label 'error' is not
> used. [unusedLabel]
> 
> This label is indeed only used conditionally, move it where it's
> actually used.
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  sound/soc/sof/intel/hda-codec.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
> index 2c5c451fa19d..119aa9ffcc66 100644
> --- a/sound/soc/sof/intel/hda-codec.c
> +++ b/sound/soc/sof/intel/hda-codec.c
> @@ -178,6 +178,11 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address,
>  	}
>  
>  	return ret;
> +
> +error:
> +	snd_hdac_ext_bus_device_exit(hdev);
> +	return -ENOENT;
> +
>  #else
>  	hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL);
>  	if (!hdev)
> -- 
> 2.25.1
> 

I don't get this patch because there is no moving of a label, it just
introduces it, where it is actually completely unused in the function as
far as I can tell in both v5.9-rc1 and next-20200821. When building with
clang in certain configurations, this introduces the same type of
warning:

sound/soc/sof/intel/hda-codec.c:182:1: warning: unused label 'error'
[-Wunused-label]
error:
^~~~~~
1 warning generated.

It seems like this should be reverted as it does not actually do
anything.

Cheers,
Nathan
Pierre-Louis Bossart Aug. 24, 2020, 2:17 p.m. UTC | #2
> I don't get this patch because there is no moving of a label, it just
> introduces it, where it is actually completely unused in the function as
> far as I can tell in both v5.9-rc1 and next-20200821. When building with
> clang in certain configurations, this introduces the same type of
> warning:
> 
> sound/soc/sof/intel/hda-codec.c:182:1: warning: unused label 'error'
> [-Wunused-label]
> error:
> ^~~~~~
> 1 warning generated.
> 
> It seems like this should be reverted as it does not actually do
> anything.

I must have made a mistake with these cppcheck patches, the patch that 
needed to be fixed is not upstream but in the SOF tree. I will send it 
later today, sorry about the noise.
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
index 2c5c451fa19d..119aa9ffcc66 100644
--- a/sound/soc/sof/intel/hda-codec.c
+++ b/sound/soc/sof/intel/hda-codec.c
@@ -178,6 +178,11 @@  static int hda_codec_probe(struct snd_sof_dev *sdev, int address,
 	}
 
 	return ret;
+
+error:
+	snd_hdac_ext_bus_device_exit(hdev);
+	return -ENOENT;
+
 #else
 	hdev = devm_kzalloc(sdev->dev, sizeof(*hdev), GFP_KERNEL);
 	if (!hdev)