From mboxrd@z Thu Jan 1 00:00:00 1970 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=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 5C79FC388F7 for ; Tue, 10 Nov 2020 20:41:54 +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 DEDDE2064B for ; Tue, 10 Nov 2020 20:41:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="RyNRBczu"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="h+ZzsVhD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEDDE2064B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com 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:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7+RAM4/0nSi7yMQpYS/btqRnJfBJ88pb59s2OB3RyeQ=; b=RyNRBczuZUUOlEZw7cqwlLVzX a2XPMwJmK/KL4UsCxk5EpUHphzyxBCqUPaFBBhvmqvzSXuEoOIS1Iv4If5yMsNuAOBsxPdkNG0VxR QW6ZlwprNfzQ9EXsL7km3ERcdmVbFHTJeX8KZFb+5Z4uBPBNK1+REFi9RBD+E5PLBUO+tdp5rH8X9 pPnSWsxh7IkTvOLuFoD4nllTUodCuLlkQptt41IoldtbGTPm9Xb4lTdeZ5tBSgE2z4CG+s6B8d9Pd ZvR9H+nsIUMludubgy9fkRt0FRaC8YlnuiwwfANGCf7SV/tB8OQz6c/rNMl/njPGTzaavGFUctuIC +dFd3/4LQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcaSI-0006Sr-VP; Tue, 10 Nov 2020 20:41:31 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcaSF-0006Rq-WB for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 20:41:29 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0AAKfHKr061019; Tue, 10 Nov 2020 14:41:17 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1605040877; bh=UucnyngDkfyTY7WroGXFJQtHbvJ9pW85bfxdBhgL8yw=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=h+ZzsVhDOnK/eUbMMaw53Uy5A1Kyg/s93PWU4ojwKV6D3ZvuBjLklGSnRPJqTqnDl ro+g25lt83gfBE/H8JN5Hl/2YI1IIe/ZcJnBvSl0OIHw7hL9CKwrWqNMLZmurg3anW +0JOs1rehnOe0BWpyDe6e/F9BMZA9pRAitHTsnCk= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0AAKfHLD110932 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 10 Nov 2020 14:41:17 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 10 Nov 2020 14:41:17 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 10 Nov 2020 14:41:17 -0600 Received: from [10.250.64.205] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0AAKfGOf097066; Tue, 10 Nov 2020 14:41:16 -0600 Subject: Re: [PATCH] soc: ti: pruss: fix return check for of_device_get_match_data() To: Lee Jones , Grzegorz Jaszczyk References: <20201110013350.2499706-1-luomeng12@huawei.com> <20201110095418.GH2063125@dell> From: Suman Anna Message-ID: Date: Tue, 10 Nov 2020 14:41:15 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201110095418.GH2063125@dell> Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_154128_175394_3BE89B3F X-CRM114-Status: GOOD ( 20.93 ) 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: Luo Meng , Roger Quadros , linux-arm-kernel@lists.infradead.org, Santosh Shilimkar Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Luo, On 11/10/20 3:54 AM, Lee Jones wrote: > On Tue, 10 Nov 2020, Grzegorz Jaszczyk wrote: > >> Hi >> >> On Tue, 10 Nov 2020 at 02:31, Luo Meng wrote: >>> >>> of_device_get_match_data() maybe return NULL pointer which cannot >>> be checked with IS_ERR. >>> >>> Fixes: ba59c9b43c86 ("soc: ti: pruss: support CORECLK_MUX and IEPCLK_MUX") >>> Reported-by: Hulk Robot >>> Signed-off-by: Luo Meng >>> --- >>> drivers/soc/ti/pruss.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c >>> index cc0b4ad7a3d3..582f48051c30 100644 >>> --- a/drivers/soc/ti/pruss.c >>> +++ b/drivers/soc/ti/pruss.c >>> @@ -126,7 +126,7 @@ static int pruss_clk_init(struct pruss *pruss, struct device_node *cfg_node) >>> int ret = 0; >>> >>> data = of_device_get_match_data(dev); >>> - if (IS_ERR(data)) >>> + if (!data) >>> return -ENODEV; > > Also this would miss any errors, leading to dereference issues. > > I think what you meant was IS_ERR_OR_NULL(), but this would still be > incorrect for the reasons Grzegorz mentions below. > >>> clks_np = of_get_child_by_name(cfg_node, "clocks"); >>> @@ -175,7 +175,7 @@ static int pruss_probe(struct platform_device *pdev) >>> const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" }; >>> >>> data = of_device_get_match_data(&pdev->dev); >>> - if (IS_ERR(data)) { >>> + if (!data) { >> >> Thank you for your interest but with your patch the driver will not be >> functional anymore for all devices without match data (e.g. >> "ti,am3356-pruss") which is not what we want. The proper fix was >> already posted end of October: >> https://patchwork.kernel.org/project/linux-arm-kernel/patch/20201026144943.30821-1-grzegorz.jaszczyk@linaro.org/ Wei Yongjun from Huawei has posted an identical patch originally [1], which is what the above patch fixes. Please use Greg's updated patch instead. regards Suman [1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/20200915075732.100804-1-weiyongjun1@huawei.com/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel