Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp194494pxb; Tue, 17 Aug 2021 23:30:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2wlKFUjLIzi6UvCzUMLsku0B6SchCz4CqiRke+/hfEWWm4Nm68oBwbvhmNNkWmw8+kfY5 X-Received: by 2002:a17:906:ca43:: with SMTP id jx3mr8141093ejb.193.1629268206701; Tue, 17 Aug 2021 23:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629268206; cv=none; d=google.com; s=arc-20160816; b=bRpk79VAJukuniEfdic8UaRV+TX8Ojwwq0UQ+Vesdx4kQNPRzSpN1Qm29cjeETzdmf caV/QwMRB7Orui++Qab+H61rKixbvpnWW7r1U3NeSF+EvhNGRsjKjoBGkeh5zDTL8K/G +Obqw9k4a5OZrr8BTRQw+kZ6/yRyq9X6cv+AZNp4uZR29t/a465yUAL7+W6sRiusVVZz bYObZmUEjN2hDD/O7OWkZwLQlzRHfD+pTIYawSpu7Ni/He15xUiYRvck/iElCtLuaOY+ HYKIEdzFNs51lVxCMWPCZc8NaBYyGS0RLneF87gw/GcszOQ9qSHfQ0W8kwxZyP3h4zKn Kbpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=90LBWazIEKjoK0LxI/aXAXtEv4SOv0xAKJYL9WzHKL4=; b=dWH25/9hc7UD2djFxMS/+XmOyLhOWvzzWrxyab9XWSeBazDUNV5d2GSDHecFopjIZ7 dUZtFG6KdMr6QQR+9JO5LDro7cL10OBVGEM5JLP6caEp9Zf1BAv7aGl3+b1sxVcxbTrA Of+m/jwX2S2szcwxqImXwGO+iwTHFhXoxfyNrVX7/uBaEBFdQEO+pGE/gHb4zblK6Zcq FN8J4jQBljGoFWwwd8S5XU5JHpF5lUAxNevE3aM7n85laZ3Ydvkd33pfMhV7bPYV4wiJ +gObIFg0/+FeDyM/NKU2swbUDTYav0ZDbiq6WyWDyZhbUiXjLd6j2DaKa/gYbeftYW7E a3ZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z19si4303036edd.572.2021.08.17.23.29.44; Tue, 17 Aug 2021 23:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240240AbhHRG0m (ORCPT + 99 others); Wed, 18 Aug 2021 02:26:42 -0400 Received: from inva020.nxp.com ([92.121.34.13]:39040 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239622AbhHRG0F (ORCPT ); Wed, 18 Aug 2021 02:26:05 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 629391A1481; Wed, 18 Aug 2021 08:25:30 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2AD7D1A146D; Wed, 18 Aug 2021 08:25:30 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id BA890183AD27; Wed, 18 Aug 2021 14:25:28 +0800 (+08) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: fsl_rpmsg: Check -EPROBE_DEFER for getting clocks Date: Wed, 18 Aug 2021 14:03:34 +0800 Message-Id: <1629266614-6942-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The devm_clk_get() may return -EPROBE_DEFER, then clocks will be assigned to NULL wrongly. As the clocks are optional so we can use devm_clk_get_optional() instead of devm_clk_get(). Fixes: b73d9e6225e8 ("ASoC: fsl_rpmsg: Add CPU DAI driver for audio base on rpmsg") Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_rpmsg.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sound/soc/fsl/fsl_rpmsg.c b/sound/soc/fsl/fsl_rpmsg.c index ea5c973e2e84..d60f4dac6c1b 100644 --- a/sound/soc/fsl/fsl_rpmsg.c +++ b/sound/soc/fsl/fsl_rpmsg.c @@ -165,25 +165,25 @@ static int fsl_rpmsg_probe(struct platform_device *pdev) } /* Get the optional clocks */ - rpmsg->ipg = devm_clk_get(&pdev->dev, "ipg"); + rpmsg->ipg = devm_clk_get_optional(&pdev->dev, "ipg"); if (IS_ERR(rpmsg->ipg)) - rpmsg->ipg = NULL; + return PTR_ERR(rpmsg->ipg); - rpmsg->mclk = devm_clk_get(&pdev->dev, "mclk"); + rpmsg->mclk = devm_clk_get_optional(&pdev->dev, "mclk"); if (IS_ERR(rpmsg->mclk)) - rpmsg->mclk = NULL; + return PTR_ERR(rpmsg->mclk); - rpmsg->dma = devm_clk_get(&pdev->dev, "dma"); + rpmsg->dma = devm_clk_get_optional(&pdev->dev, "dma"); if (IS_ERR(rpmsg->dma)) - rpmsg->dma = NULL; + return PTR_ERR(rpmsg->dma); - rpmsg->pll8k = devm_clk_get(&pdev->dev, "pll8k"); + rpmsg->pll8k = devm_clk_get_optional(&pdev->dev, "pll8k"); if (IS_ERR(rpmsg->pll8k)) - rpmsg->pll8k = NULL; + return PTR_ERR(rpmsg->pll8k); - rpmsg->pll11k = devm_clk_get(&pdev->dev, "pll11k"); + rpmsg->pll11k = devm_clk_get_optional(&pdev->dev, "pll11k"); if (IS_ERR(rpmsg->pll11k)) - rpmsg->pll11k = NULL; + return PTR_ERR(rpmsg->pll11k); platform_set_drvdata(pdev, rpmsg); pm_runtime_enable(&pdev->dev); -- 2.27.0