[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRvAMfwh9GnaNV7U@orome.fritz.box>
Date: Tue, 17 Aug 2021 15:57:05 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: Aakash Hemadri <aakashhemadri123@...il.com>
Cc: Mark Brown <broonie@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
alsa-devel@...a-project.org, linux-tegra@...r.kernel.org,
linux-kernel@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>,
Bjorn Helgaas <bjorn@...gaas.com>
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 <aakashhemadri123@...il.com>
> ---
> 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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists