From patchwork Thu Dec 10 08:04:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Ruehl X-Patchwork-Id: 11963653 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=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 9C40DC4361B for ; Thu, 10 Dec 2020 08:06:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A99223D4E for ; Thu, 10 Dec 2020 08:06:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A99223D4E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gtsys.com.hk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=6vJVjRcfydKKnLKybTfL2BUt8kg2DGp7PP3tozlLBOQ=; b=WIgqkK32g+ZrsDa1UapzZI2LoC j4UByRPRXnbz6HCf+sXZvVYOBJYt/PeqCruBhnSuW/gFiaSwFSBn5XAjvUpVQYEski8m0tJD1U4/x 0avWxUkjo+oZxIapFoKCcbgrsOyesxuM5t45TgoDfGI2bAuuNcwt1GTp2ymTLgGsBmBp4yC9kBtux +pzGkcDNiTtcWJUX/wjG5Xik95KtjjtaYjITqQssSVrXoat6ih/aXMM5wCM8/6DbTWOBG45jCGU2h oxlBNX6Is0DLp4ZglokvMnhkj5CP066Rl46bzkDaT4IaB34aeDmWNUTOWIhDRcvh3MhaBR0U6qR4/ bW/xTy5A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knGwk-0003Xl-6f; Thu, 10 Dec 2020 08:05:06 +0000 Received: from [27.111.83.178] (helo=mail.gtsys.com.hk) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knGwh-0003Wp-2G; Thu, 10 Dec 2020 08:05:04 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.gtsys.com.hk (Postfix) with ESMTP id D08EF2290B46; Thu, 10 Dec 2020 16:04:57 +0800 (HKT) X-Virus-Scanned: Debian amavisd-new at gtsys.com.hk Received: from mail.gtsys.com.hk ([127.0.0.1]) by localhost (mail.gtsys.com.hk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hmHa6fFH6lqd; Thu, 10 Dec 2020 16:04:57 +0800 (HKT) Received: from s01.gtsys.com.hk (unknown [10.128.4.2]) by mail.gtsys.com.hk (Postfix) with ESMTP id AF0E82290B45; Thu, 10 Dec 2020 16:04:57 +0800 (HKT) Received: from armhf2.gtsys.com.hk (unknown [10.128.4.15]) by s01.gtsys.com.hk (Postfix) with ESMTP id A2428C01FB5; Thu, 10 Dec 2020 16:04:57 +0800 (HKT) Received: by armhf2.gtsys.com.hk (Postfix, from userid 1000) id 5568D2000CF; Thu, 10 Dec 2020 16:04:57 +0800 (HKT) From: Chris Ruehl To: linux-rockchip@lists.infradead.org Subject: [PATCH v3] phy: rockchip-emmc: emmc_phy_init() always return 0 Date: Thu, 10 Dec 2020 16:04:54 +0800 Message-Id: <20201210080454.17379-1-chris.ruehl@gtsys.com.hk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201210_030503_307996_B046A0B4 X-CRM114-Status: GOOD ( 12.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Chris Ruehl , Heiko Stuebner , linux-kernel@vger.kernel.org, Douglas Anderson , Vinod Koul , Kishon Vijay Abraham I , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org rockchip_emmc_phy_init() return variable is not set with the error value if clk_get() failed. 'emmcclk' is optional, thus use clk_get_optional() and if the return value != NULL make error processing and set the return code accordingly. Fixes: 52c0624a10cce phy: rockchip-emmc: Set phyctrl_frqsel based on card clock Signed-off-by: Chris Ruehl Reviewed-by: Douglas Anderson --- v3 - IS_ERROR() already return false if rk_phy->emmcclk == NULL add Reviewed tag v2 - use clk_get_optional drivers/phy/rockchip/phy-rockchip-emmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-emmc.c b/drivers/phy/rockchip/phy-rockchip-emmc.c index 48e2d75b1004..9d8123f7fd07 100644 --- a/drivers/phy/rockchip/phy-rockchip-emmc.c +++ b/drivers/phy/rockchip/phy-rockchip-emmc.c @@ -245,15 +245,17 @@ static int rockchip_emmc_phy_init(struct phy *phy) * - SDHCI driver to get the PHY * - SDHCI driver to init the PHY * - * The clock is optional, so upon any error we just set to NULL. + * The clock is optional, using clk_get_optional() to get the clock + * and do error processing if the return value != NULL * * NOTE: we don't do anything special for EPROBE_DEFER here. Given the * above expected use case, EPROBE_DEFER isn't sensible to expect, so * it's just like any other error. */ - rk_phy->emmcclk = clk_get(&phy->dev, "emmcclk"); + rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk"); if (IS_ERR(rk_phy->emmcclk)) { - dev_dbg(&phy->dev, "Error getting emmcclk: %d\n", ret); + ret = PTR_ERR(rk_phy->emmcclk); + dev_err(&phy->dev, "Error getting emmcclk: %d\n", ret); rk_phy->emmcclk = NULL; }