Re: [PATCH v2 1/5] ASoC: Explicitly include correct DT includes

2023-10-04 Thread claudiu beznea



On 04.10.2023 18:58, Rob Herring wrote:
> The DT of_device.h and of_platform.h date back to the separate
> of_platform_bus_type before it was merged into the regular platform bus.
> As part of that merge prepping Arm DT support 13 years ago, they
> "temporarily" include each other. They also include platform_device.h
> and of.h. As a result, there's a pretty much random mix of those include
> files used throughout the tree. In order to detangle these headers and
> replace the implicit includes with struct declarations, users need to
> explicitly include the correct includes.
> 
> Acked-by: Jernej Skrabec 
> Reviewed-by: AngeloGioacchino Del Regno 
> 
> Acked-by: Charles Keepax 
> Signed-off-by: Rob Herring 
> ---
>  sound/soc/atmel/atmel_wm8904.c | 1 -
>  sound/soc/atmel/mchp-i2s-mcc.c | 2 +-
>  sound/soc/atmel/tse850-pcm5142.c   | 1 -

Reviewed-by: Claudiu Beznea  # for at91


[PATCH] ASoC: imx-audmix: check return value of devm_kasprintf()

2023-06-14 Thread Claudiu Beznea
devm_kasprintf() returns a pointer to dynamically allocated memory.
Pointer could be NULL in case allocation fails. Check pointer validity.
Identified with coccinelle (kmerr.cocci script).

Fixes: b86ef5367761 ("ASoC: fsl: Add Audio Mixer machine driver")
Signed-off-by: Claudiu Beznea 
---

Hi,

This has been addressed using kmerr.cocci script proposed for update
at [1].

Thank you,
Claudiu Beznea

[1] 
https://lore.kernel.org/all/20230530074044.1603426-1-claudiu.bez...@microchip.com/

 sound/soc/fsl/imx-audmix.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/fsl/imx-audmix.c b/sound/soc/fsl/imx-audmix.c
index 2c57fe9d2d08..af06268ee57b 100644
--- a/sound/soc/fsl/imx-audmix.c
+++ b/sound/soc/fsl/imx-audmix.c
@@ -228,6 +228,8 @@ static int imx_audmix_probe(struct platform_device *pdev)
 
dai_name = devm_kasprintf(>dev, GFP_KERNEL, "%s%s",
  fe_name_pref, args.np->full_name + 1);
+   if (!dai_name)
+   return -ENOMEM;
 
dev_info(pdev->dev.parent, "DAI FE name:%s\n", dai_name);
 
@@ -236,6 +238,8 @@ static int imx_audmix_probe(struct platform_device *pdev)
capture_dai_name =
devm_kasprintf(>dev, GFP_KERNEL, "%s %s",
   dai_name, "CPU-Capture");
+   if (!capture_dai_name)
+   return -ENOMEM;
}
 
priv->dai[i].cpus = [0];
@@ -263,6 +267,8 @@ static int imx_audmix_probe(struct platform_device *pdev)
   "AUDMIX-Playback-%d", i);
be_cp = devm_kasprintf(>dev, GFP_KERNEL,
   "AUDMIX-Capture-%d", i);
+   if (!be_name || !be_pb || !be_cp)
+   return -ENOMEM;
 
priv->dai[num_dai + i].cpus = [2];
priv->dai[num_dai + i].codecs = [3];
@@ -287,6 +293,9 @@ static int imx_audmix_probe(struct platform_device *pdev)
priv->dapm_routes[i].source =
devm_kasprintf(>dev, GFP_KERNEL, "%s %s",
   dai_name, "CPU-Playback");
+   if (!priv->dapm_routes[i].source)
+   return -ENOMEM;
+
priv->dapm_routes[i].sink = be_pb;
priv->dapm_routes[num_dai + i].source   = be_pb;
priv->dapm_routes[num_dai + i].sink = be_cp;
-- 
2.34.1



[PATCH v2 2/2] ASoC: use pm.h instead of runtime_pm.h

2023-05-17 Thread Claudiu Beznea
Do not include pm_runtime.h header in files where runtime PM support is
not implemented. Use pm.h instead as suspend to RAM specific
implementation is available.

Signed-off-by: Claudiu Beznea 
---
 sound/soc/codecs/max98373-i2c.c | 2 +-
 sound/soc/qcom/lpass-sc7180.c   | 2 +-
 sound/soc/qcom/lpass-sc7280.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c
index 3d6da4f133de..0fa5ceca62a2 100644
--- a/sound/soc/codecs/max98373-i2c.c
+++ b/sound/soc/codecs/max98373-i2c.c
@@ -9,7 +9,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index 41db6617e2ed..56db852f4eab 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/qcom/lpass-sc7280.c b/sound/soc/qcom/lpass-sc7280.c
index d43f480cbae3..bcf18fe8e14d 100644
--- a/sound/soc/qcom/lpass-sc7280.c
+++ b/sound/soc/qcom/lpass-sc7280.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
-- 
2.34.1



[PATCH v2 1/2] ASoC: do not include pm_runtime.h if not used

2023-05-17 Thread Claudiu Beznea
Do not include pm_runtime.h header in files where APIs exported by
pm_runtime.h are not used.

Signed-off-by: Claudiu Beznea 
Acked-by: Jarkko Nikula  # for omap-mcbsp-st.c
---
 sound/hda/hdac_regmap.c   | 1 -
 sound/pci/hda/hda_bind.c  | 1 -
 sound/soc/amd/acp/acp-pci.c   | 1 -
 sound/soc/amd/acp/acp-platform.c  | 1 -
 sound/soc/codecs/max98090.c   | 1 -
 sound/soc/codecs/pcm186x.c| 1 -
 sound/soc/codecs/rk3328_codec.c   | 1 -
 sound/soc/codecs/rt5682-i2c.c | 1 -
 sound/soc/codecs/rt5682s.c| 1 -
 sound/soc/codecs/tas2562.c| 1 -
 sound/soc/codecs/tas5720.c| 1 -
 sound/soc/codecs/tas6424.c| 1 -
 sound/soc/codecs/wm_adsp.c| 1 -
 sound/soc/fsl/imx-audmix.c| 1 -
 sound/soc/intel/atom/sst/sst_acpi.c   | 1 -
 sound/soc/intel/atom/sst/sst_ipc.c| 1 -
 sound/soc/intel/atom/sst/sst_loader.c | 1 -
 sound/soc/intel/atom/sst/sst_pci.c| 1 -
 sound/soc/intel/atom/sst/sst_stream.c | 1 -
 sound/soc/mediatek/mt8186/mt8186-afe-control.c| 1 -
 sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c | 1 -
 sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c  | 1 -
 sound/soc/mediatek/mt8192/mt8192-afe-control.c| 2 --
 sound/soc/soc-compress.c  | 1 -
 sound/soc/soc-pcm.c   | 1 -
 sound/soc/sof/intel/hda-loader-skl.c  | 1 -
 sound/soc/sof/intel/hda-stream.c  | 1 -
 sound/soc/sof/intel/skl.c | 1 -
 sound/soc/sof/mediatek/mt8186/mt8186-clk.c| 1 -
 sound/soc/sof/mediatek/mt8195/mt8195-clk.c| 1 -
 sound/soc/tegra/tegra20_ac97.c| 1 -
 sound/soc/ti/omap-mcbsp-st.c  | 1 -
 32 files changed, 33 deletions(-)

diff --git a/sound/hda/hdac_regmap.c b/sound/hda/hdac_regmap.c
index fe3587547cfe..7cfaa908ff57 100644
--- a/sound/hda/hdac_regmap.c
+++ b/sound/hda/hdac_regmap.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index 890c2f7c33fc..b7ca2a83fbb0 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "hda_local.h"
diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c
index a0c84cd07fde..8154fbfd1229 100644
--- a/sound/soc/amd/acp/acp-pci.c
+++ b/sound/soc/amd/acp/acp-pci.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "amd.h"
diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c
index 447612a7a762..f220378ec20e 100644
--- a/sound/soc/amd/acp/acp-platform.c
+++ b/sound/soc/amd/acp/acp-platform.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "amd.h"
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index ad417d80691f..7bc463910d4f 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/codecs/pcm186x.c b/sound/soc/codecs/pcm186x.c
index dd21803ba13c..451a8fd8fac5 100644
--- a/sound/soc/codecs/pcm186x.c
+++ b/sound/soc/codecs/pcm186x.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/codecs/rk3328_codec.c b/sound/soc/codecs/rk3328_codec.c
index 1d523bfd9d84..9697aefc6e03 100644
--- a/sound/soc/codecs/rk3328_codec.c
+++ b/sound/soc/codecs/rk3328_codec.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index d0041ba1e627..a88fcf507386 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/codecs/rt5682s.c b/sound/soc/codecs/rt5682s.c
index 81163b026b9e..cc12df15ee86 100644
--- a/sound/soc/codecs/rt5682s.c
+++ b/sound/soc/codecs/rt5682s.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index 2012d6f0071d..962c2cdfa017 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -8,

[PATCH v2 0/2] ASoC: do not include runtime_pm.h if not needed

2023-05-17 Thread Claudiu Beznea
Hi,

Series removes the pm_runtime.h inclusion in files where
APIs exported though pm_runtime.h are not used. In case
of files that make use of pm.h which comes form pm_runtime.h
added patch 2/2.

Changes were built with allmodconfig on ARM and x86_64 and checked
all the changed files were built at least once.

Thank you,
Claudiu Beznea

Changes in v2:
- removed cs35l45 handling
- changed a bit commit description
- added patch 2/2
- collected Jarkko Nikula's tag

Claudiu Beznea (2):
  ASoC: do not include pm_runtime.h if not used
  ASoC: use pm.h instead of runtime_pm.h

 sound/hda/hdac_regmap.c   | 1 -
 sound/pci/hda/hda_bind.c  | 1 -
 sound/soc/amd/acp/acp-pci.c   | 1 -
 sound/soc/amd/acp/acp-platform.c  | 1 -
 sound/soc/codecs/max98090.c   | 1 -
 sound/soc/codecs/max98373-i2c.c   | 2 +-
 sound/soc/codecs/pcm186x.c| 1 -
 sound/soc/codecs/rk3328_codec.c   | 1 -
 sound/soc/codecs/rt5682-i2c.c | 1 -
 sound/soc/codecs/rt5682s.c| 1 -
 sound/soc/codecs/tas2562.c| 1 -
 sound/soc/codecs/tas5720.c| 1 -
 sound/soc/codecs/tas6424.c| 1 -
 sound/soc/codecs/wm_adsp.c| 1 -
 sound/soc/fsl/imx-audmix.c| 1 -
 sound/soc/intel/atom/sst/sst_acpi.c   | 1 -
 sound/soc/intel/atom/sst/sst_ipc.c| 1 -
 sound/soc/intel/atom/sst/sst_loader.c | 1 -
 sound/soc/intel/atom/sst/sst_pci.c| 1 -
 sound/soc/intel/atom/sst/sst_stream.c | 1 -
 sound/soc/mediatek/mt8186/mt8186-afe-control.c| 1 -
 sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c | 1 -
 sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c  | 1 -
 sound/soc/mediatek/mt8192/mt8192-afe-control.c| 2 --
 sound/soc/qcom/lpass-sc7180.c | 2 +-
 sound/soc/qcom/lpass-sc7280.c | 2 +-
 sound/soc/soc-compress.c  | 1 -
 sound/soc/soc-pcm.c   | 1 -
 sound/soc/sof/intel/hda-loader-skl.c  | 1 -
 sound/soc/sof/intel/hda-stream.c  | 1 -
 sound/soc/sof/intel/skl.c | 1 -
 sound/soc/sof/mediatek/mt8186/mt8186-clk.c| 1 -
 sound/soc/sof/mediatek/mt8195/mt8195-clk.c| 1 -
 sound/soc/tegra/tegra20_ac97.c| 1 -
 sound/soc/ti/omap-mcbsp-st.c  | 1 -
 35 files changed, 3 insertions(+), 36 deletions(-)

-- 
2.34.1



[PATCH] ASoC: do not include pm_runtime.h if not used

2023-03-07 Thread Claudiu Beznea
Do not include pm_runtime.h header in files where runtime PM support is
not implemented.

Signed-off-by: Claudiu Beznea 
---
 sound/hda/hdac_regmap.c   | 1 -
 sound/pci/hda/hda_bind.c  | 1 -
 sound/soc/amd/acp/acp-pci.c   | 1 -
 sound/soc/amd/acp/acp-platform.c  | 1 -
 sound/soc/codecs/cs35l45.h| 1 -
 sound/soc/codecs/max98090.c   | 1 -
 sound/soc/codecs/max98373-i2c.c   | 1 -
 sound/soc/codecs/pcm186x.c| 1 -
 sound/soc/codecs/rk3328_codec.c   | 1 -
 sound/soc/codecs/rt5682-i2c.c | 1 -
 sound/soc/codecs/rt5682s.c| 1 -
 sound/soc/codecs/tas2562.c| 1 -
 sound/soc/codecs/tas5720.c| 1 -
 sound/soc/codecs/tas6424.c| 1 -
 sound/soc/codecs/wm_adsp.c| 1 -
 sound/soc/fsl/imx-audmix.c| 1 -
 sound/soc/intel/atom/sst/sst_acpi.c   | 1 -
 sound/soc/intel/atom/sst/sst_ipc.c| 1 -
 sound/soc/intel/atom/sst/sst_loader.c | 1 -
 sound/soc/intel/atom/sst/sst_pci.c| 1 -
 sound/soc/intel/atom/sst/sst_stream.c | 1 -
 sound/soc/mediatek/mt8186/mt8186-afe-control.c| 1 -
 sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c | 1 -
 sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c  | 1 -
 sound/soc/mediatek/mt8192/mt8192-afe-control.c| 2 --
 sound/soc/qcom/lpass-sc7180.c | 1 -
 sound/soc/qcom/lpass-sc7280.c | 1 -
 sound/soc/soc-compress.c  | 1 -
 sound/soc/soc-pcm.c   | 1 -
 sound/soc/sof/intel/hda-loader-skl.c  | 1 -
 sound/soc/sof/intel/hda-stream.c  | 1 -
 sound/soc/sof/intel/skl.c | 1 -
 sound/soc/sof/mediatek/mt8186/mt8186-clk.c| 1 -
 sound/soc/sof/mediatek/mt8195/mt8195-clk.c| 1 -
 sound/soc/tegra/tegra20_ac97.c| 1 -
 sound/soc/ti/omap-mcbsp-st.c  | 1 -
 36 files changed, 37 deletions(-)

diff --git a/sound/hda/hdac_regmap.c b/sound/hda/hdac_regmap.c
index fe3587547cfe..7cfaa908ff57 100644
--- a/sound/hda/hdac_regmap.c
+++ b/sound/hda/hdac_regmap.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index 1a868dd9dc4b..323c388b1219 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "hda_local.h"
diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c
index a0c84cd07fde..8154fbfd1229 100644
--- a/sound/soc/amd/acp/acp-pci.c
+++ b/sound/soc/amd/acp/acp-pci.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "amd.h"
diff --git a/sound/soc/amd/acp/acp-platform.c b/sound/soc/amd/acp/acp-platform.c
index 447612a7a762..f220378ec20e 100644
--- a/sound/soc/amd/acp/acp-platform.c
+++ b/sound/soc/amd/acp/acp-platform.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "amd.h"
diff --git a/sound/soc/codecs/cs35l45.h b/sound/soc/codecs/cs35l45.h
index 53fe9d2b7b15..0555702eac03 100644
--- a/sound/soc/codecs/cs35l45.h
+++ b/sound/soc/codecs/cs35l45.h
@@ -11,7 +11,6 @@
 #ifndef CS35L45_H
 #define CS35L45_H
 
-#include 
 #include 
 #include 
 
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 06ed2a938108..508086e6e39f 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c
index ec0905df65d1..0ef33404252d 100644
--- a/sound/soc/codecs/max98373-i2c.c
+++ b/sound/soc/codecs/max98373-i2c.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/codecs/pcm186x.c b/sound/soc/codecs/pcm186x.c
index dd21803ba13c..451a8fd8fac5 100644
--- a/sound/soc/codecs/pcm186x.c
+++ b/sound/soc/codecs/pcm186x.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/sound/soc/codecs/rk3328_codec.c b/sound/soc/codecs/rk3328_codec.c
index 1d523bfd9d84..9697aefc6e03 100644
--- a/sound/soc/codecs/rk3328_codec.c
+++ b/sound/soc/codecs/rk3328_codec.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #inclu