From patchwork Wed Jan 14 18:42:28 2015 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: 5634581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2063D9F444 for ; Wed, 14 Jan 2015 18:46:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 623FD20160 for ; Wed, 14 Jan 2015 18:46:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 241852012E for ; Wed, 14 Jan 2015 18:46:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YBSvl-00061T-Fi; Wed, 14 Jan 2015 18:44:37 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YBSuf-0005QS-Ks for linux-arm-kernel@lists.infradead.org; Wed, 14 Jan 2015 18:43:30 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NI600K8FJZUJT70@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 15 Jan 2015 03:43:07 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-8c-54b6b8bac5c0 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AD.58.09430.AB8B6B45; Thu, 15 Jan 2015 03:43:06 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NI600JMDJZE6P20@mmp1.samsung.com>; Thu, 15 Jan 2015 03:43:06 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, kgene@kernel.org Subject: [PATCH V3 01/15] ASoC: samsung: i2s: samsung_i2s_get_driver_data() cleanup Date: Wed, 14 Jan 2015 19:42:28 +0100 Message-id: <1421260962-16892-2-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1421260962-16892-1-git-send-email-s.nawrocki@samsung.com> References: <1421260962-16892-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCLMWRmVeSWpSXmKPExsVy+t9jAd1dO7aFGNw6ZmFx5eIhJoupD5+w Wcw/co7V4tH8x8wW/Y9fM1tsenyN1WLG+X1MFr9vfmezOPymndXi4oovTA5cHhs+N7F5LPqe 5bFpVSebx+Yl9R59W1YxenzeJBfAFsVlk5Kak1mWWqRvl8CVsWN3E1PBf46KbXe3sDYw7mDv YuTgkBAwkeicItHFyAlkiklcuLeerYuRi0NIYBGjxJq2biing0li5fJZTCBVbAKGEr1H+xhB bBEBDYktG98ygRQxC3xllPg/tZcFJCEsECrx8/FaNpANLAKqEs9PR4CEeQXcJN4/28UMsVhB Ys4kG5Awp4C7xOVzd8HGC4GUXPrOOoGRdwEjwypG0dSC5ILipPRcI73ixNzi0rx0veT83E2M 4LB7Jr2DcVWDxSFGAQ5GJR5ehyNbQ4RYE8uKK3MPMUpwMCuJ8K7asi1EiDclsbIqtSg/vqg0 J7X4EKM0B4uSOK+SfVuIkEB6YklqdmpqQWoRTJaJg1OqgVE6Mz3smOvchN69p777vT+ZaiTx juUje86+u2+/c4U+f8q/dGKhCrfX3WlHlQo2P+d4uTjiC9uDNZ9cnV2q7V/M+Wb/LnfvZHlt vqCJEmaqbV9bPnW97pp07snu1YUrBZQZ+vwWCCtJnLxRrtQwNaVutlKYRNX69wGVf/l0Sz6+ /vXvYLqB0C0lluKMREMt5qLiRAAhAygPNwIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150114_104329_868228_6187DA2B X-CRM114-Status: UNSURE ( 9.75 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.0 (-----) Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.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 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 86491c9..e5473ee 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