]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ASoC: samsung: i2s: samsung_i2s_get_driver_data() cleanup
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Wed, 14 Jan 2015 18:42:28 +0000 (19:42 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 14 Jan 2015 19:46:53 +0000 (19:46 +0000)
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>
sound/soc/samsung/i2s.c

index 86491c9f121fe6723b23f582327fc55bcd084561..e5473ee799d7701853b9cc4f9e3c3b238b8d2b69 100644 (file)
@@ -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