2021-08-16 21:16:24

by Aakash Hemadri

[permalink] [raw]
Subject: [PATCH 0/2] 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(-)

--
2.32.0


2021-08-16 21:16:24

by Aakash Hemadri

[permalink] [raw]
Subject: [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")

Signed-off-by: Aakash Hemadri <[email protected]>
---
sound/soc/tegra/tegra30_ahub.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index 0ac109b32329..ef011a488ceb 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -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);
--
2.32.0

2021-08-16 21:16:33

by Aakash Hemadri

[permalink] [raw]
Subject: [PATCH 2/2] ASoC: tegra30: i2s: 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_i2s_soc_data *soc_data` with
const void *of_device_get_match_data(...)

Fixes: 356b94a32a75 ("ASoC: tegra30: i2s: Use of_device_get_match_data")

Signed-off-by: Aakash Hemadri <[email protected]>
---
sound/soc/tegra/tegra30_i2s.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index d4c5594efaf1..084a533bf4f2 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -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);
--
2.32.0

2021-08-17 13:57:24

by Thierry Reding

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

On Tue, Aug 17, 2021 at 02:44:51AM +0530, Aakash Hemadri wrote:
> 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")
>
> Signed-off-by: Aakash Hemadri <[email protected]>
> ---
> sound/soc/tegra/tegra30_ahub.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
> index 0ac109b32329..ef011a488ceb 100644
> --- a/sound/soc/tegra/tegra30_ahub.c
> +++ b/sound/soc/tegra/tegra30_ahub.c
> @@ -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;

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


Attachments:
(No filename) (1.65 kB)
signature.asc (849.00 B)
Download all attachments

2021-08-17 13:58:34

by Thierry Reding

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

On Tue, Aug 17, 2021 at 02:44:52AM +0530, Aakash Hemadri wrote:
> 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")
>
> Signed-off-by: Aakash Hemadri <[email protected]>
> ---
> sound/soc/tegra/tegra30_i2s.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
> index d4c5594efaf1..084a533bf4f2 100644
> --- a/sound/soc/tegra/tegra30_i2s.c
> +++ b/sound/soc/tegra/tegra30_i2s.c
> @@ -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;

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


Attachments:
(No filename) (1.82 kB)
signature.asc (849.00 B)
Download all attachments

2021-08-17 14:24:56

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/2] ASoC: tegra30: Fix use of of_device_get_match_data

On Tue, 17 Aug 2021 02:44:50 +0530, Aakash Hemadri wrote:
> 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