Skip to contentSkip to conversation

ASoC: tegra30: Fix use of of_device_get_match_data

PATCH In review Aakash Hemadri 3 participants 6 messages Aug 16, 2021 – Aug 17, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: tegra30: Fix use of of_device_get_match_data

Hi,
This patchset fixes my previous incorrect patches.

356b94a32a75 ("ASoC: tegra30: i2s: Use of_device_get_match_data") 80165bb80433 ("ASoC: tegra30: ahub: Use of_device_get_match_data")

Aakash Hemadri (2):
ASoC: tegra30: ahub: Fix incorrect usage of of_device_get_match_data
ASoC: tegra30: i2s: Fix incorrect usage of of_device_get_match_data

 sound/soc/tegra/tegra30_ahub.c | 6 ++----
 sound/soc/tegra/tegra30_i2s.c  | 8 ++++----
 2 files changed, 6 insertions(+), 8 deletions(-)
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/2 ASoC: tegra30: ahub: Fix incorrect usage of of_device_get_match_data

const struct of_device_id incorrectly assigned "match->data" using of_device_get_match_data()

Instead assign const struct tegra30_ahub_soc_data *soc_data with const void *of_device_get_match_data(...)

Fixes 80165bb80433 ("ASoC: tegra30: ahub: Use of_device_get_match_data")
---
 sound/soc/tegra/tegra30_ahub.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/tegra/tegra30_ahub.c +2 -4
index 0ac109b32329..ef011a488ceb 100644
@@ -512,16 +512,14 @@ static const struct of_device_id tegra30_ahub_of_match[] = {
 
 static int tegra30_ahub_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	const struct tegra30_ahub_soc_data *soc_data;
 	struct resource *res0;
 	void __iomem *regs_apbif, *regs_ahub;
 	int ret = 0;
 
-	match = of_device_get_match_data(&pdev->dev);
-	if (!match)
+	soc_data = of_device_get_match_data(&pdev->dev);
+	if (!soc_data)
 		return -EINVAL;
-	soc_data = match->data;
 
 	ahub = devm_kzalloc(&pdev->dev, sizeof(struct tegra30_ahub),
 			    GFP_KERNEL);
Signature · 1 line
2.32.0
#2 lore raw

Re: [PATCH 1/2] ASoC: tegra30: ahub: Fix incorrect usage of of_device_get_match_data

Quoted 23 lines · Aakash Hemadri

const struct of_device_id incorrectly assigned "match->data" using of_device_get_match_data()

Instead assign const struct tegra30_ahub_soc_data *soc_data with const void *of_device_get_match_data(...)

Fixes 80165bb80433 ("ASoC: tegra30: ahub: Use of_device_get_match_data")
---
 sound/soc/tegra/tegra30_ahub.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/tegra/tegra30_ahub.c +0 -1
index 0ac109b32329..ef011a488ceb 100644
@@ -512,16 +512,14 @@ static const struct of_device_id tegra30_ahub_of_match[] = {
 
 static int tegra30_ahub_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	const struct tegra30_ahub_soc_data *soc_data;

sound/soc/tegra/tegra30_ahub.c static const struct of_device_id tegra30_ahub_of_match[] = { · line 524

Quoted 10 lines
sound/soc/tegra/tegra30_ahub.c +2 -3
 	struct resource *res0;
 	void __iomem *regs_apbif, *regs_ahub;
 	int ret = 0;
 
-	match = of_device_get_match_data(&pdev->dev);
-	if (!match)
+	soc_data = of_device_get_match_data(&pdev->dev);
+	if (!soc_data)
 		return -EINVAL;
-	soc_data = match->data;

Minor nit: !soc_data can actually never happen for this driver. First, tegra30_ahub_probe() will only ever be called if there was a match with an entry from the OF device ID table, and then all entries have .data set to a valid point.

It's a pre-existing issue, but since all of the surrounding code is already getting updated, perhaps it'd be a good idea to fix that up while at it.

Thierry

#3 lore raw

PATCH 2/2 ASoC: tegra30: i2s: Fix incorrect usage of of_device_get_match_data

In reply to Aakash Hemadri

const struct of_device_id incorrectly assigned "match->data" using
of_device_get_match_data()

Instead assign const struct tegra30_i2s_soc_data *soc_data with const void *of_device_get_match_data(...)

Fixes 356b94a32a75 ("ASoC: tegra30: i2s: Use of_device_get_match_data")
---
 sound/soc/tegra/tegra30_i2s.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/tegra/tegra30_i2s.c +4 -4
index d4c5594efaf1..084a533bf4f2 100644
@@ -406,7 +406,7 @@ static const struct of_device_id tegra30_i2s_of_match[] = {
 static int tegra30_i2s_platform_probe(struct platform_device *pdev)
 {
 	struct tegra30_i2s *i2s;
-	const struct of_device_id *match;
+	const struct tegra30_i2s_soc_data *soc_data;
 	u32 cif_ids[2];
 	void __iomem *regs;
 	int ret;
@@ -418,13 +418,13 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev)
 	}
 	dev_set_drvdata(&pdev->dev, i2s);
 
-	match = of_device_get_match_data(&pdev->dev);
-	if (!match) {
+	soc_data = of_device_get_match_data(&pdev->dev);
+	if (!soc_data) {
 		dev_err(&pdev->dev, "Error: No device match found\n");
 		ret = -ENODEV;
 		goto err;
 	}
-	i2s->soc_data = (struct tegra30_i2s_soc_data *)match->data;
+	i2s->soc_data = soc_data;
 
 	i2s->dai = tegra30_i2s_dai_template;
 	i2s->dai.name = dev_name(&pdev->dev);
Signature · 1 line
2.32.0
#4 lore raw

Re: [PATCH 2/2] ASoC: tegra30: i2s: Fix incorrect usage of of_device_get_match_data

Quoted 30 lines · Aakash Hemadri

const struct of_device_id incorrectly assigned "match->data" using
of_device_get_match_data()

Instead assign const struct tegra30_i2s_soc_data *soc_data with const void *of_device_get_match_data(...)

Fixes 356b94a32a75 ("ASoC: tegra30: i2s: Use of_device_get_match_data")
---
 sound/soc/tegra/tegra30_i2s.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/tegra/tegra30_i2s.c +1 -1
index d4c5594efaf1..084a533bf4f2 100644
@@ -406,7 +406,7 @@ static const struct of_device_id tegra30_i2s_of_match[] = {
 static int tegra30_i2s_platform_probe(struct platform_device *pdev)
 {
 	struct tegra30_i2s *i2s;
-	const struct of_device_id *match;
+	const struct tegra30_i2s_soc_data *soc_data;
 	u32 cif_ids[2];
 	void __iomem *regs;
 	int ret;
@@ -418,13 +418,13 @@ static int tegra30_i2s_platform_probe(struct platform_device *pdev)
 	}
 	dev_set_drvdata(&pdev->dev, i2s);
 

sound/soc/tegra/tegra30_i2s.c static int tegra30_i2s_platform_probe(struct platform_device *pdev) · line 427

Quoted 10 lines
sound/soc/tegra/tegra30_i2s.c +3 -3
-	match = of_device_get_match_data(&pdev->dev);
-	if (!match) {
+	soc_data = of_device_get_match_data(&pdev->dev);
+	if (!soc_data) {
 		dev_err(&pdev->dev, "Error: No device match found\n");
 		ret = -ENODEV;
 		goto err;
 	}
-	i2s->soc_data = (struct tegra30_i2s_soc_data *)match->data;
+	i2s->soc_data = soc_data;

Same comment as for the AHUB patch, although there's a bit more potential to save boilerplate here. For instance, there's really no need for the local "soc_data" variable here, so you can assign to i2s->soc_data directly and then leave out the unnecessary check as well.

Thierry

maintainer
#5 lore raw
In reply to Aakash Hemadri
Quoted 10 lines · Aakash Hemadri

This patchset fixes my previous incorrect patches.

356b94a32a75 ("ASoC: tegra30: i2s: Use of_device_get_match_data") 80165bb80433 ("ASoC: tegra30: ahub: Use of_device_get_match_data")

Aakash Hemadri (2):
ASoC: tegra30: ahub: Fix incorrect usage of of_device_get_match_data
ASoC: tegra30: i2s: Fix incorrect usage of of_device_get_match_data

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: tegra30: ahub: Fix incorrect usage of of_device_get_match_data

      commit: ea2efedefbc34f782db396c3d90e80aa1fff57a5
[2/2] ASoC: tegra30: i2s: Fix incorrect usage of of_device_get_match_data
      commit: 240fdf3f42fc6505adecaf5a74fac75b3c702cf1

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