From patchwork Tue May 5 22:52:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Cernekee X-Patchwork-Id: 6344681 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 43347BEEE1 for ; Tue, 5 May 2015 22:53:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D2AA201BB for ; Tue, 5 May 2015 22:53:08 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 27DDD20125 for ; Tue, 5 May 2015 22:53:07 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id B68E62654DD; Wed, 6 May 2015 00:53:05 +0200 (CEST) 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 1A3FE2604BE; Wed, 6 May 2015 00:52:58 +0200 (CEST) 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 918F92604BE; Wed, 6 May 2015 00:52:56 +0200 (CEST) Received: from mail-ig0-f174.google.com (mail-ig0-f174.google.com [209.85.213.174]) by alsa0.perex.cz (Postfix) with ESMTP id 79B962604A7 for ; Wed, 6 May 2015 00:52:49 +0200 (CEST) Received: by igblo3 with SMTP id lo3so114861314igb.1 for ; Tue, 05 May 2015 15:52:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tilOu5YJVgesI6rDADJuwUUCrnfMTa/2QhSMWMOF3jc=; b=BfYEnM38J2JsgNVGzqK5Mj+YJY3vWubA9dJ870Q/+wBupFKPVZsPI/44Sdh3t5D9yp LpWDrZyJz3hsuQlfW4/EsdRVYgVLJbUFZEGMWeJakjMjXNEUY6wvyY0PLTLfwJID4wXU Kvav/SBAcDjy5QFPQUSHbLe6bPwknweU/vEXrUWMN7+bZmKStf5hYP8utdHol5sHXSJd b8tVHuq+YpBSOj+jrBkhlQLRZelcpcRosBgxQRRxrcCGjpS8vCnj1qKYRjPYajHy9s3V r5SBIU/vZpUjHNEq5dztRyFxMkpmLMhDyT95g+lZgB4o7XcD69QgP8IjOMQMEGbmT9rD YfXg== X-Gm-Message-State: ALoCoQnwLIYli+TP6cLw0SEoQ/pExUsjONKHWjVYHPtHYJkBc38SxWQQT6b8gQ6fLs7l4tcwetn+ X-Received: by 10.42.81.6 with SMTP id x6mr31627164ick.89.1430866368499; Tue, 05 May 2015 15:52:48 -0700 (PDT) Received: from kcl.mtv.corp.google.com ([172.22.66.15]) by mx.google.com with ESMTPSA id f11sm12704711iod.7.2015.05.05.15.52.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 15:52:47 -0700 (PDT) From: Kevin Cernekee To: lgirdwood@gmail.com, broonie@kernel.org Date: Tue, 5 May 2015 15:52:29 -0700 Message-Id: <1430866350-21391-1-git-send-email-cernekee@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c Cc: alsa-devel@alsa-project.org, lars@metafoo.de, abrestic@chromium.org, linux-kernel@vger.kernel.org, dgreid@chromium.org, olofj@chromium.org Subject: [alsa-devel] [PATCH] ASoC: tas571x: Eliminate redundant dev->of_node NULL check 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 of_match_device() checks if dev->of_node is NULL, so we don't need to do it again in the probe function. Signed-off-by: Kevin Cernekee --- This applies to the broonie/sound.git for-next branch. sound/soc/codecs/tas571x.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c index b187ea53a7f9..85bcc374c8e8 100644 --- a/sound/soc/codecs/tas571x.c +++ b/sound/soc/codecs/tas571x.c @@ -377,6 +377,7 @@ static int tas571x_i2c_probe(struct i2c_client *client, { struct tas571x_private *priv; struct device *dev = &client->dev; + const struct of_device_id *of_id; int i, ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -384,18 +385,12 @@ static int tas571x_i2c_probe(struct i2c_client *client, return -ENOMEM; i2c_set_clientdata(client, priv); - if (dev->of_node) { - const struct of_device_id *of_id; - - of_id = of_match_device(tas571x_of_match, dev); - if (of_id) - priv->chip = of_id->data; - } - - if (!priv->chip) { + of_id = of_match_device(tas571x_of_match, dev); + if (!of_id) { dev_err(dev, "Unknown device type\n"); return -EINVAL; } + priv->chip = of_id->data; priv->mclk = devm_clk_get(dev, "mclk"); if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) != -ENOENT) {