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: 5634481 Return-Path: X-Original-To: patchwork-alsa-devel@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 240829F444 for ; Wed, 14 Jan 2015 18:43:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DE10201B9 for ; Wed, 14 Jan 2015 18:43:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 08ABC201C0 for ; Wed, 14 Jan 2015 18:43:55 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3CF30265367; Wed, 14 Jan 2015 19:43:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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 B81222651D1; Wed, 14 Jan 2015 19:43:16 +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 5DF192652CE; Wed, 14 Jan 2015 19:43:15 +0100 (CET) Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by alsa0.perex.cz (Postfix) with ESMTP id 285E6261A01 for ; Wed, 14 Jan 2015 19:43:09 +0100 (CET) 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 alsa-devel@alsa-project.org; Thu, 15 Jan 2015 03:43:06 +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 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== 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 Subject: [alsa-devel] [PATCH V3 01/15] 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 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