Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3868077pxv; Mon, 19 Jul 2021 10:40:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRhWW6kuf5zTrCWxOxIdgT3KjoifGqz7ylCxunqtDQI5Pi5QFXZtCmvtndeSGzzRL2oWTK X-Received: by 2002:a50:d642:: with SMTP id c2mr35335746edj.22.1626716288673; Mon, 19 Jul 2021 10:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626716288; cv=none; d=google.com; s=arc-20160816; b=FSrq9KTpptJV3SXhBzakltBeL8S0SktQQcgz7xwVQByXhS3fKY9sTIV9/lQb+N6Ego WrnoWzkInnV3g294gwim59KtOvfFKQTselDqaxoFD6fyhb7G5zrb0+gBb9VYO27YTk31 hyZzMSK/Rii5U82M2c/prZSZtKvbyIsu9tRNtZ3PBTl2ZjOZIyMvZKfiOzX6oxozcXYB yLffoIK55iqmQIZfmYNnKaIi3f4JZtd5p30BAHcSDtSDhgP27Pk0TaodI3Qcbj84M7pG O4sEYQZGG37vdTvjWzrAgjK0j7VyFYCInL9GLT14ycGT2wpuARoEyzg3KczGBmt5NydS gm+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8oDHsnjtp5w6Xo3fk+L7ufPv6nA0p1CzvwLrTpL8BAY=; b=dkteqFtzHLG78mlphF1Z2x+539wWDke6JqX96+Yhm1K/pZrAVIw+lCYYnF96QQtEWY vhOqunj7/7YQRJ40jO/3mmO27kCAQ8LwN6CAM9fSGa5K+K65/gNNbO5XK7czRuv8Wg6i uF8AhhQr6iqhtLX0q3APbBhjBgETCc5Usea/XarowZeLzEWNk9IgLJWpkNZStN+H2Sr3 lyn9aaE6CDgEFa4cT/+Pq5cqAoJojuCnVkk2cWKYF8tCA7ENOqCnZ2fkkQlov6x1oC7A f0PhiYFXD3buc6Auclr26Ye464xVMMcYjKcx00By0/dpmWMap8eW8jOfTMLowUg1O+AM nD5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QqvKIMuF; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qb32si22369250ejc.619.2021.07.19.10.37.46; Mon, 19 Jul 2021 10:38:08 -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=@linuxfoundation.org header.s=korg header.b=QqvKIMuF; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358022AbhGSQwm (ORCPT + 99 others); Mon, 19 Jul 2021 12:52:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:57794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347569AbhGSPTq (ORCPT ); Mon, 19 Jul 2021 11:19:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C959560200; Mon, 19 Jul 2021 15:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626710309; bh=K6sT0z5Ze+D+76RPWYHyQ8VyASl+PDH7AZMuq3ukA9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QqvKIMuFS045Jz1ExaJ4N2PjRwp4n/QjbhJmwAnAoO5jg8PVA4pl2pbnNgnbdgQ7h reCn87IY+KuORZwa23UKoFUecWY/rptI4QNWyBTEvN6BmiUr73POm/7nCn3cZr7Els tYWr6jh32Y4ZVeaW7JjNxrrAV1OSljmKAWZ385t8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Paul Cercueil , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.10 162/243] watchdog: jz4740: Fix return value check in jz4740_wdt_probe() Date: Mon, 19 Jul 2021 16:53:11 +0200 Message-Id: <20210719144946.129121807@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144940.904087935@linuxfoundation.org> References: <20210719144940.904087935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wei Yongjun [ Upstream commit 29e85f53fb58b45b9e9276dcdf1f1cb762dd1c9f ] In case of error, the function device_node_to_regmap() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 6d532143c915 ("watchdog: jz4740: Use regmap provided by TCU driver") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Acked-by: Paul Cercueil Link: https://lore.kernel.org/r/20210304045909.945799-1-weiyongjun1@huawei.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/jz4740_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c index bdf9564efa29..395bde79e292 100644 --- a/drivers/watchdog/jz4740_wdt.c +++ b/drivers/watchdog/jz4740_wdt.c @@ -176,9 +176,9 @@ static int jz4740_wdt_probe(struct platform_device *pdev) watchdog_set_drvdata(jz4740_wdt, drvdata); drvdata->map = device_node_to_regmap(dev->parent->of_node); - if (!drvdata->map) { + if (IS_ERR(drvdata->map)) { dev_err(dev, "regmap not found\n"); - return -EINVAL; + return PTR_ERR(drvdata->map); } return devm_watchdog_register_device(dev, &drvdata->wdt); -- 2.30.2