[alsa-devel] [PATCH 1/2] ASoC: sh: rcar: core: don't open code of_device_get_match_data()
From: Wolfram Sang wsa+renesas@sang-engineering.com
This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable.
Signed-off-by: Wolfram Sang wsa+renesas@sang-engineering.com ---
Compile tested only. I am on the road and can't test the multimedia drivers because of no cables :( If someone could test it, that would be much appreciated. Or I'll do it next week. The pattern worked for other drivers I could actually test, though.
sound/soc/sh/rcar/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 5227aad43e3854..3dae30710c34f2 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1119,7 +1119,6 @@ static int rsnd_probe(struct platform_device *pdev) struct rsnd_priv *priv; struct device *dev = &pdev->dev; struct rsnd_dai *rdai; - const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev); int (*probe_func[])(struct rsnd_priv *priv) = { rsnd_gen_probe, rsnd_dma_probe, @@ -1145,7 +1144,7 @@ static int rsnd_probe(struct platform_device *pdev) }
priv->pdev = pdev; - priv->flags = (unsigned long)of_id->data; + priv->flags = (unsigned long)of_device_get_match_data(dev); spin_lock_init(&priv->lock);
/*
From: Wolfram Sang wsa+renesas@sang-engineering.com
This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable.
Signed-off-by: Wolfram Sang wsa+renesas@sang-engineering.com ---
Compile tested only. I am on the road and can't test the multimedia drivers because of no cables :( If someone could test it, that would be much appreciated. Or I'll do it next week. The pattern worked for other drivers I could actually test, though.
sound/soc/sh/rcar/rsrc-card.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 8a357fdf1077c9..545e94245e62c9 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -71,7 +71,6 @@ struct rsrc_card_priv { #define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev) #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i)) #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i)) -#define rsrc_dev_to_of_data(dev) (of_match_device(rsrc_card_of_match, (dev))->data)
static int rsrc_card_startup(struct snd_pcm_substream *substream) { @@ -246,7 +245,7 @@ static int rsrc_card_parse_links(struct device_node *np, struct device *dev = rsrc_priv_to_dev(priv); const struct rsrc_card_of_data *of_data;
- of_data = rsrc_dev_to_of_data(dev); + of_data = of_device_get_match_data(dev);
/* FE is dummy */ dai_link->cpu_of_node = NULL; @@ -396,7 +395,7 @@ static int rsrc_card_parse_of(struct device_node *node, struct rsrc_card_priv *priv, struct device *dev) { - const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev); + const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev); struct rsrc_card_dai *props; struct snd_soc_dai_link *links; int ret;
On Tue, Mar 1, 2016 at 5:39 PM, Wolfram Sang wsa@the-dreams.de wrote:
From: Wolfram Sang wsa+renesas@sang-engineering.com
This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable.
Signed-off-by: Wolfram Sang wsa+renesas@sang-engineering.com
Acked-by: Geert Uytterhoeven geert+renesas@glider.be
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
On Tue, Mar 01, 2016 at 05:39:20PM +0100, Wolfram Sang wrote:
Signed-off-by: Wolfram Sang wsa+renesas@sang-engineering.com
Please ensure that your signoffs match the domain you're sending from, at least the domain part - I'm fairly sure you're the same person but it's not something I should need to think about.
The patch
ASoC: sh: rcar: rsrc-card: don't open code of_device_get_match_data()
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
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
From 6a16c1765120abc8f58b2c5f275c95a33bb25572 Mon Sep 17 00:00:00 2001
From: Wolfram Sang wsa+renesas@sang-engineering.com Date: Tue, 1 Mar 2016 17:39:20 +0100 Subject: [PATCH] ASoC: sh: rcar: rsrc-card: don't open code of_device_get_match_data()
This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable.
Signed-off-by: Wolfram Sang wsa+renesas@sang-engineering.com Acked-by: Geert Uytterhoeven geert+renesas@glider.be Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/sh/rcar/rsrc-card.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 8a357fdf1077..545e94245e62 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -71,7 +71,6 @@ struct rsrc_card_priv { #define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev) #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i)) #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i)) -#define rsrc_dev_to_of_data(dev) (of_match_device(rsrc_card_of_match, (dev))->data)
static int rsrc_card_startup(struct snd_pcm_substream *substream) { @@ -246,7 +245,7 @@ static int rsrc_card_parse_links(struct device_node *np, struct device *dev = rsrc_priv_to_dev(priv); const struct rsrc_card_of_data *of_data;
- of_data = rsrc_dev_to_of_data(dev); + of_data = of_device_get_match_data(dev);
/* FE is dummy */ dai_link->cpu_of_node = NULL; @@ -396,7 +395,7 @@ static int rsrc_card_parse_of(struct device_node *node, struct rsrc_card_priv *priv, struct device *dev) { - const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev); + const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev); struct rsrc_card_dai *props; struct snd_soc_dai_link *links; int ret;
On Tue, Mar 1, 2016 at 5:39 PM, Wolfram Sang wsa@the-dreams.de wrote:
From: Wolfram Sang wsa+renesas@sang-engineering.com
This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable.
Signed-off-by: Wolfram Sang wsa+renesas@sang-engineering.com
Acked-by: Geert Uytterhoeven geert+renesas@glider.be
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
The patch
ASoC: sh: rcar: core: don't open code of_device_get_match_data()
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
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
From 6d8044b4ff305238503edca7d75f3ab7410396ba Mon Sep 17 00:00:00 2001
From: Wolfram Sang wsa+renesas@sang-engineering.com Date: Tue, 1 Mar 2016 17:39:19 +0100 Subject: [PATCH] ASoC: sh: rcar: core: don't open code of_device_get_match_data()
This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable.
Signed-off-by: Wolfram Sang wsa+renesas@sang-engineering.com Acked-by: Geert Uytterhoeven geert+renesas@glider.be Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/sh/rcar/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 21e13b3a356f..ba37b0d55b21 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1119,7 +1119,6 @@ static int rsnd_probe(struct platform_device *pdev) struct rsnd_priv *priv; struct device *dev = &pdev->dev; struct rsnd_dai *rdai; - const struct of_device_id *of_id = of_match_device(rsnd_of_match, dev); int (*probe_func[])(struct rsnd_priv *priv) = { rsnd_gen_probe, rsnd_dma_probe, @@ -1145,7 +1144,7 @@ static int rsnd_probe(struct platform_device *pdev) }
priv->pdev = pdev; - priv->flags = (unsigned long)of_id->data; + priv->flags = (unsigned long)of_device_get_match_data(dev); spin_lock_init(&priv->lock);
/*
participants (3)
-
Geert Uytterhoeven
-
Mark Brown
-
Wolfram Sang