From patchwork Fri Dec 19 13:55:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 5519491 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7C5B2BEEA8 for ; Fri, 19 Dec 2014 13:58:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B197620142 for ; Fri, 19 Dec 2014 13:58:17 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7998E2010C for ; Fri, 19 Dec 2014 13:58:16 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 776D2265053; Fri, 19 Dec 2014 14:58:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 03C79264F30; Fri, 19 Dec 2014 14:57:24 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 538BE264F31; Fri, 19 Dec 2014 14:57:22 +0100 (CET) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by alsa0.perex.cz (Postfix) with ESMTP id 85566264EFF for ; Fri, 19 Dec 2014 14:56:54 +0100 (CET) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NGU004CZ1ES7W30@mailout3.samsung.com> for alsa-devel@alsa-project.org; Fri, 19 Dec 2014 22:56:52 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-eb-54942ea462f1 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C2.14.20081.4AE24945; Fri, 19 Dec 2014 22:56:52 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NGU00HVQ1CREV30@mmp2.samsung.com>; Fri, 19 Dec 2014 22:56:52 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, kgene@kernel.org, alsa-devel@alsa-project.org Date: Fri, 19 Dec 2014 14:55:22 +0100 Message-id: <1418997336-17777-3-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1418997336-17777-1-git-send-email-s.nawrocki@samsung.com> References: <1418997336-17777-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCLMWRmVeSWpSXmKPExsVy+t9jQd0lelNCDHY91LS4cvEQk8XUh0/Y LOYfOcdq8Wj+Y2aL/sevmS02Pb7GajHj/D4mi983v7NZHH7TzmpxccUXJgcujw2fm9g8Fn3P 8ti0qpPNY/OSeo++LasYPT5vkgtgi+KySUnNySxLLdK3S+DKeLx0C1NBO2fFjX8XmRoYD7B3 MXJySAiYSMz7Op8FwhaTuHBvPVsXIxeHkMB0Rom/y6ayQzgdTBK/lj5mBqliEzCU6D3axwhi iwi4Sjz+f5MFpIhZ4BqjxItPU4A6ODiEBUIl3mzwB6lhEVCVOPP1KiuIzSvgJnHgbzMbSImE gILEnEk2ICangLvEsqUeIBVCQBXbT2xnm8DIu4CRYRWjaGpBckFxUnquoV5xYm5xaV66XnJ+ 7iZGcNg9k9rBuLLB4hCjAAejEg9vR+HkECHWxLLiytxDjBIczEoivB+Fp4QI8aYkVlalFuXH F5XmpBYfYpTmYFES51WybwsREkhPLEnNTk0tSC2CyTJxcEo1MAZPOK3wdd3FimkbT6lKtHbl F1/KK/x68u2Z0rZ04yNpprkvbwZ6axmt+1G+/0Dfy2AOUaYfiqK2x+rqFWKM+Wc+41FwDuJ4 feYFz4+H/CUnWifIPOQsdJDgqTDfPm3DJsdCk4Npb/kiZObW1n6+8LtvbpLyhFdKf5e0i8tE a1t9Zvu9PUFSSImlOCPRUIu5qDgRAKKiU8s3AgAA Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, padma.v@samsung.com, sbkim73@samsung.com, drake@endlessm.com, Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2 02/16] ASoC: samsung: i2s: samsung_i2s_get_driver_data() cleanup X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- sound/soc/samsung/i2s.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 827e4b4..430298c 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_RUNTIME