From patchwork Wed Sep 2 19:36:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 256346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 501EEC433E2 for ; Wed, 2 Sep 2020 19:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2ED8821527 for ; Wed, 2 Sep 2020 19:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599075483; bh=ysxU/OkPk0mx2jmOsOpW9mYF9nZJUrqNoDbkIh/24jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=H/EYL7RHrcrJQssLZNqBMkyrJTHU/I6JZuHmKrzaSto8EirWlZh6+QtnXOyZxr2yA im1tI+2LlxjqupyRNrQEG/IQzMg4Q/ouvuu+6uWhgmV2BoCx4VrAKbCdCqxPAkLNNw 1GkclVhzQpc5Fb2UuEBaZe49y3sKOLxy8DKjiBzs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbgIBTiC (ORCPT ); Wed, 2 Sep 2020 15:38:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:43588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbgIBTiB (ORCPT ); Wed, 2 Sep 2020 15:38:01 -0400 Received: from kozik-lap.mshome.net (unknown [194.230.155.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AAFBC20E65; Wed, 2 Sep 2020 19:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599075480; bh=ysxU/OkPk0mx2jmOsOpW9mYF9nZJUrqNoDbkIh/24jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vpFu8350AnZO/VZulHS3cosgdptpwzKBP54kcGKYYm+c84d7OK0hpajGsgvwtOFKS kmJCuXW8VdBTDiKusxw3hbdgYxmp3Agznd240GsJTGXakAFEVej8jF2rXA0RVL33Bn QWutahXiiNH/ft4IpIIAIUlTNFX4B8Oe+FxhtXwM= From: Krzysztof Kozlowski To: Ulf Hansson , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Nicolas Saenz Julienne , Jaehoon Chung , Jun Nie , Shawn Guo , Paul Cercueil , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Al Cooper , Adrian Hunter , Michal Simek , Lars Povlsen , Steen Hegelund , Microchip Linux Driver Support , Thierry Reding , Jonathan Hunter , Arnd Bergmann , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-tegra@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [RFT 06/11] mmc: sdhci-brcmstb: Simplify with optional clock and dev_err_probe() Date: Wed, 2 Sep 2020 21:36:53 +0200 Message-Id: <20200902193658.20539-7-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200902193658.20539-1-krzk@kernel.org> References: <20200902193658.20539-1-krzk@kernel.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Only -ENOENT from devm_clk_get() means that clock is not present in device tree. Other errors have their own meaning and should not be ignored. Simplify getting the clock which is in fact optional and also use dev_err_probe() for handling deferred. Signed-off-by: Krzysztof Kozlowski --- Not tested on HW. --- drivers/mmc/host/sdhci-brcmstb.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index ad01f6451a95..876668827580 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -235,13 +235,11 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probe found match for %s\n", match->compatible); - clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - if (PTR_ERR(clk) == -EPROBE_DEFER) - return -EPROBE_DEFER; - dev_err(&pdev->dev, "Clock not found in Device Tree\n"); - clk = NULL; - } + clk = devm_clk_get_optional(&pdev->dev, NULL); + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "Failed to get clock from Device Tree\n"); + res = clk_prepare_enable(clk); if (res) return res;