Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp615630pxk; Thu, 17 Sep 2020 11:23:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2Ccdy7xn5DOmB3YxYGK/+Kw6iQ9Rczhe+QwLPrDAG+ETxLvMYzUB6QzfgR5NiwGEqx+VI X-Received: by 2002:a50:bb65:: with SMTP id y92mr34209122ede.53.1600366990785; Thu, 17 Sep 2020 11:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600366990; cv=none; d=google.com; s=arc-20160816; b=uRWT4hqvqMH+zIjh9oyF+BfjLZWWHL3/mm+6H3N+oxYhtkStu40SeESaqysjloJEfi par8wr+fXcmDbdN9QXkAH7G8DmmGXkXB5fkmGCkYZjUz9YdK4lpPQlhVL9MqiAJ6zqD8 k1aU9VT9CA2kNp2YcehJbXEbPNwo2WH3nDH4Ln+W0YghZCEmBpK+/FcVGK9NE/tj7T6G Q8BuXkom72X/03MbjFUEXxxwQW7PZSp2ir3ze72XfSa3x5NrIqmRFLxaGya5czE1tzPj TmYzKdboJ2noCPVVmJjzXZmnjptWw0xrDO6KOSfItViRK9f54n3roeaae2WUsyioRN+w Vu8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ki8/NOkpFvs3XxTS93OGfUDB/VnTY+Hw6EkRY5HIJZs=; b=TXATU4eIzJfxsfgoyXNYrEmudH/PtyeUkyaJZ0egFHJkrHF7OYZse6EzXX6H6/ZzYa x6x+4AZ9zsex7jg6BQrUtdPgDrCae+CHG3iZOVvGBH67q0yPw4uualTlEoLkQqB875dJ Fw+gzvaAoaLyoGFzRPxBueAGmhn4RhBVLTrwtvmcCas1xCjIJFlejc+BJF4r2STPhuxx 1lCX5CXvTjvixHtr9dffWBylocqBcXeKnbp+/eKCcQyMxpa8ssDbgBfOgoGcYHHl4W1x gYLU0uDc30KSh16mDRx1ahWOlfWRoM8uzqhX8UcBJVS5GKFvFxtXSV6u6q0C/KcZf9Oo wEuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GZaBRiQ9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si366142edn.316.2020.09.17.11.22.46; Thu, 17 Sep 2020 11:23:10 -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; dkim=pass header.i=@linaro.org header.s=google header.b=GZaBRiQ9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726592AbgIQSUe (ORCPT + 99 others); Thu, 17 Sep 2020 14:20:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbgIQSSV (ORCPT ); Thu, 17 Sep 2020 14:18:21 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B518FC06174A for ; Thu, 17 Sep 2020 11:17:39 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id z2so2637437qtv.12 for ; Thu, 17 Sep 2020 11:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ki8/NOkpFvs3XxTS93OGfUDB/VnTY+Hw6EkRY5HIJZs=; b=GZaBRiQ9WPc7NkQAE0jqjGGYjkOYBWmzeGoKul57v7BPJfgPhtlrZXHUW6mbS6ZDCA tNSk9vQhRNReJ9gBsoGDPjgl+T4eT6te0GK4HtRB1w1dPUHxfpiLB1Etmbz21pSgEKGP /P0iKQuLf4R0h4k3a9BfatYorU2kLtm8+GgWMrOxkjuSFzBWmNTlzMpRj4B/8yggeu36 NMJL+gte16yTX0LBooeg+GUUg+VkYShK61Q0Zya9ngcgi9ACOs+sv4aCyOh9uxe8fhq2 I2Ar1q1ixCmOhpIW2pM0umipFIvANhdcly/BFa+PE/Ozbu6wtOcVsFNuKs/WymIUbFEG wlHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ki8/NOkpFvs3XxTS93OGfUDB/VnTY+Hw6EkRY5HIJZs=; b=LwfCE3rJxHpGPrHEZrNXdkKtK3/5aO+3qZIbRdrC5undz46QHXsN/k7RZa6NLPXPgJ Ffhj3oD0/SUKNQVmwRe6HNYDm+I3NUnZ6GUt62Lv57yMjO9kKRxMVlCEQRhIK0v72NQX u5omIzevXNjGOBRgqgf90J6KckHO0kO6T0Z04rAk/XCuiMPmRyfU4BzyiWXaLJ1QtfS3 Ted4PozHIaEinhqH43bK171CNKgDPDQkXd/mPKsGKevLvSGLLKWUTpe2j1BjRzOYxdYj TXXU+5ZrDN6N5CObkelDcfTgjv/NyBIbXt5z0TQXEo9HyPN51izUmYx1rPFWWx8waJVw 7apQ== X-Gm-Message-State: AOAM533X9HFTdmW1JUiknoocB9OtC3MfoKONL16cK3ufGjEN/mKsNNeM TatUb9S00GpEgvspA5MFGuoIkNTQuRrAVu80YySu7g== X-Received: by 2002:ac8:748c:: with SMTP id v12mr28117317qtq.200.1600366658123; Thu, 17 Sep 2020 11:17:38 -0700 (PDT) MIME-Version: 1.0 References: <20200915075732.100804-1-weiyongjun1@huawei.com> In-Reply-To: <20200915075732.100804-1-weiyongjun1@huawei.com> From: Grzegorz Jaszczyk Date: Thu, 17 Sep 2020 20:17:27 +0200 Message-ID: Subject: Re: [PATCH -next] soc: ti: pruss: Fix return value check To: Wei Yongjun Cc: Santosh Shilimkar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-janitors@vger.kernel.org, Hulk Robot , "Anna, Suman" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On Tue, 15 Sep 2020 at 09:58, Wei Yongjun wrote: > > In case of error, the function of_device_get_match_data() returns NULL > pointer not ERR_PTR(). The IS_ERR() test in the return value check > should be replaced with NULL test. > > Fixes: ba59c9b43c86 ("soc: ti: pruss: support CORECLK_MUX and IEPCLK_MUX") > Reported-by: Hulk Robot > Signed-off-by: Wei Yongjun > --- > 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; > > 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) { > dev_err(dev, "missing private data\n"); > return -ENODEV; > } First of all thank you for reporting this issue. Indeed the IS_ERR is wrongly used and is leftover from a bit different former internal implementation. Nevertheless with your fix 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 would be removing the mentioned error checks, since the "data" in both cases is checked later, before usage: if (data && data->...). Please let me know if you want to improve this patch by yourself or want me to push a proper fix with your e.g. "Reported-by:" tag. For me both solutions are ok. Thank you, Grzegorz