Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96D65C7EE24 for ; Tue, 6 Jun 2023 14:16:50 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id F255783A; Tue, 6 Jun 2023 16:15:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F255783A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686061008; bh=gMjHyvne6Agp54WGv+UFFXIKF10PxNqoZ0FJ4APZ9UI=; h=Date:Subject:To:CC:References:From:In-Reply-To:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Ylj45Mdav2zjjXHD2///xFXX++uTC8bdrFe95zLAjAB1XJX4UcLa8nUpqW6Ni9Iqd lwcgmvmGyPal5nhTDUqg0GDw9p5mGOJGVQMiFxMLsoZxiJ9R/zkQVYZL3QA+4Si7VR 2VEsPjSLkkvp0xqZ4OGj94zTWBwkamL5EBf5p68U= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 286F4F8057F; Tue, 6 Jun 2023 16:15:04 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 5A7E8F8057A; Tue, 6 Jun 2023 16:15:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 951F3F80199; Tue, 6 Jun 2023 15:03:50 +0200 (CEST) Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A0A62F800C8 for ; Tue, 6 Jun 2023 15:03:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A0A62F800C8 Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 25F6D80B6; Tue, 6 Jun 2023 21:03:29 +0800 (CST) Received: from EXMBX168.cuchost.com (172.16.6.78) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 6 Jun 2023 21:03:29 +0800 Received: from [192.168.125.124] (183.27.98.75) by EXMBX168.cuchost.com (172.16.6.78) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 6 Jun 2023 21:03:28 +0800 Message-ID: Date: Tue, 6 Jun 2023 21:03:27 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [bug report] ASoC: starfive: Add JH7110 TDM driver Content-Language: en-US To: Dan Carpenter CC: References: From: Walker Chen In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [183.27.98.75] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX168.cuchost.com (172.16.6.78) X-YovoleRuleAgent: yovoleflag X-MailFrom: walker.chen@starfivetech.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: FMVGJ2KZJDSNXLTNCLHZSNIRHT3G64QT X-Message-ID-Hash: FMVGJ2KZJDSNXLTNCLHZSNIRHT3G64QT X-Mailman-Approved-At: Tue, 06 Jun 2023 14:14:54 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 2023/6/6 16:27, Dan Carpenter wrote: > Hello Walker Chen, > > The patch fd4762b6b5cf: "ASoC: starfive: Add JH7110 TDM driver" from > May 26, 2023, leads to the following Smatch static checker warning: > > sound/soc/starfive/jh7110_tdm.c:584 jh7110_tdm_clk_reset_get() > warn: passing zero to 'PTR_ERR' > > sound/soc/starfive/jh7110_tdm.c > 564 static int jh7110_tdm_clk_reset_get(struct platform_device *pdev, > 565 struct jh7110_tdm_dev *tdm) > 566 { > 567 int ret; > 568 > 569 tdm->clks[0].id = "mclk_inner"; > 570 tdm->clks[1].id = "tdm_ahb"; > 571 tdm->clks[2].id = "tdm_apb"; > 572 tdm->clks[3].id = "tdm_internal"; > 573 tdm->clks[4].id = "tdm_ext"; > 574 tdm->clks[5].id = "tdm"; > 575 > 576 ret = devm_clk_bulk_get(&pdev->dev, ARRAY_SIZE(tdm->clks), tdm->clks); > 577 if (ret) { > 578 dev_err(&pdev->dev, "Failed to get tdm clocks\n"); > 579 return ret; > 580 } > 581 > 582 tdm->resets = devm_reset_control_array_get_exclusive(&pdev->dev); > > The devm_reset_control_array_get() function returns NULL if it's > an optional request. But this is not optional. > > 583 if (IS_ERR_OR_NULL(tdm->resets)) { > > So that means this should be an if (IS_ERR()) check. > > --> 584 ret = PTR_ERR(tdm->resets); > 585 dev_err(&pdev->dev, "Failed to get tdm resets"); > > Or if optional was intended then NULL should not be treated as an error > case, but as a special kind of success case (no error message). See > my blog for a long form of this information: > > https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/ > Hi Dan, Thanks for your testing. Yes, should use IS_ERR() to check. I am preparing to submit a patch to fix this issue. Best regards, Walker