diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2015-01-14 19:42:28 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-14 19:46:53 +0000 |
commit | 9cf247473167df29a3d99464385b4afe1fc16f2f (patch) | |
tree | aed74abfcf041b897bb5be228ff50c09f1f53cc3 /sound/soc/samsung/i2s.c | |
parent | fce091ee0a7f25108c7ab3eb06b9e436b7aeac11 (diff) | |
download | linux-stable-9cf247473167df29a3d99464385b4afe1fc16f2f.tar.gz linux-stable-9cf247473167df29a3d99464385b4afe1fc16f2f.tar.bz2 linux-stable-9cf247473167df29a3d99464385b4afe1fc16f2f.zip |
ASoC: samsung: i2s: samsung_i2s_get_driver_data() cleanup
Tidy up the samsung_i2s_get_driver_data() function by using
IS_ENABLE() instead of #ifdef and add missing braces for
the 'else' part. Also ensure we are not dereferencing NULL
'match' pointer.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/samsung/i2s.c')
-rw-r--r-- | sound/soc/samsung/i2s.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 86491c9f121f..e5473ee799d7 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1123,15 +1123,14 @@ static const struct of_device_id exynos_i2s_match[]; static inline const struct samsung_i2s_dai_data *samsung_i2s_get_driver_data( struct platform_device *pdev) { -#ifdef CONFIG_OF - if (pdev->dev.of_node) { + if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) { const struct of_device_id *match; match = of_match_node(exynos_i2s_match, pdev->dev.of_node); - return match->data; - } else -#endif + return match ? match->data : NULL; + } else { return (struct samsung_i2s_dai_data *) platform_get_device_id(pdev)->driver_data; + } } #ifdef CONFIG_PM |