From patchwork Tue Mar 1 16:39:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 8467041 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 08BEDC0553 for ; Tue, 1 Mar 2016 16:41:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3756B202FF for ; Tue, 1 Mar 2016 16:41:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 011562024F for ; Tue, 1 Mar 2016 16:41:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 16187261AA0; Tue, 1 Mar 2016 17:41:23 +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,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4DA07261A40; Tue, 1 Mar 2016 17:40:38 +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 4019A265DB1; Tue, 1 Mar 2016 17:40:37 +0100 (CET) Received: from pokefinder.org (sauhun.de [89.238.76.85]) by alsa0.perex.cz (Postfix) with ESMTP id 1C5A1261A40 for ; Tue, 1 Mar 2016 17:39:55 +0100 (CET) Received: from p5082e975.dip0.t-ipconnect.de ([80.130.233.117]:52924 helo=localhost) by pokefinder.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1aanKy-0004Ms-Cn; Tue, 01 Mar 2016 17:39:52 +0100 From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Date: Tue, 1 Mar 2016 17:39:20 +0100 Message-Id: <1456850381-8621-2-git-send-email-wsa@the-dreams.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456850381-8621-1-git-send-email-wsa@the-dreams.de> References: <1456850381-8621-1-git-send-email-wsa@the-dreams.de> Cc: Liam Girdwood , alsa-devel@alsa-project.org, Mark Brown , Kuninori Morimoto , Wolfram Sang Subject: [alsa-devel] [PATCH 2/2] ASoC: sh: rcar: rsrc-card: don't open code of_device_get_match_data() 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 From: Wolfram Sang This change will also make Coverity happy by avoiding a theoretical NULL pointer dereference; yet another reason is to use the above helper function to tighten the code and make it more readable. Signed-off-by: Wolfram Sang Acked-by: Geert Uytterhoeven --- Compile tested only. I am on the road and can't test the multimedia drivers because of no cables :( If someone could test it, that would be much appreciated. Or I'll do it next week. The pattern worked for other drivers I could actually test, though. sound/soc/sh/rcar/rsrc-card.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 8a357fdf1077c9..545e94245e62c9 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -71,7 +71,6 @@ struct rsrc_card_priv { #define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev) #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i)) #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i)) -#define rsrc_dev_to_of_data(dev) (of_match_device(rsrc_card_of_match, (dev))->data) static int rsrc_card_startup(struct snd_pcm_substream *substream) { @@ -246,7 +245,7 @@ static int rsrc_card_parse_links(struct device_node *np, struct device *dev = rsrc_priv_to_dev(priv); const struct rsrc_card_of_data *of_data; - of_data = rsrc_dev_to_of_data(dev); + of_data = of_device_get_match_data(dev); /* FE is dummy */ dai_link->cpu_of_node = NULL; @@ -396,7 +395,7 @@ static int rsrc_card_parse_of(struct device_node *node, struct rsrc_card_priv *priv, struct device *dev) { - const struct rsrc_card_of_data *of_data = rsrc_dev_to_of_data(dev); + const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev); struct rsrc_card_dai *props; struct snd_soc_dai_link *links; int ret;