Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp230523imi; Thu, 21 Jul 2022 20:22:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1stFgI/nAWrUoxTx7Z/z9XwGVHzTERI3evm15fycd8Ndh8CrKEnvxSwzqWr103TGo4mv4/3 X-Received: by 2002:a17:90a:db0b:b0:1f2:25c3:9faf with SMTP id g11-20020a17090adb0b00b001f225c39fafmr10111623pjv.105.1658460135268; Thu, 21 Jul 2022 20:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658460135; cv=none; d=google.com; s=arc-20160816; b=IQhSQWFH12AlGJeqoYKOQjaKRal6/AwdWx1PuvtM4OcTA31PY1pcPvmiM5/csnuU/5 /1QMahm/AfqEMAjTfx1z5Hdow96zsvlB3No+wUqQIiDEE3Y9QbeXNHUmySoJ19juu4Z6 HdRXqf/F1eokiR8uxM6okSB+3bEcEIyFarTo5tGeYBX7kAzlICWhaYAj15a5DchRfDdh 0JvADgTKRT+ICxWCclUb/2jWPXfhwi1vQ+fCqDC6gvd6A3MLipJUFhFw4oGYat3J+dy7 ZB7oaWNxXCHkbDC8EMIyjAgsHl051ZpZdbGLEdT7PxcrDTuM3kShH2l/3mmDEXHGvlti DyCA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=6h2N+wVtwTpvgrUCLikpNV+DWbwPlk278dYKE8sSdoQ=; b=T/FsBIfKDUapuvm5t9XXnEpIu/hHon7MEnt878uIFkVUm0BUIl+Xr5MqxWH9RteQbJ BZ0bExg0JBkOQJZVXxzviUVxaGqFBYWCUWVJk/2JBRtz6nF3Eknfz4eXeB6J3K+Vv2Xx 2cbZTPKz6tZNn3kTiikAZijYfblHWndG3eokmqGjVCzkw/5NRjrYYQ+6Kgdw/gyxGAem UNQxkATsj+8loGNbUuIRyJrjkQljtFaOjgjgzy3/vkD/mqIeb6XxMi3PxNwklLr7xFMC pwJ2YkccKyqkulyy1yQtODPh7MiHwhft4OL70MSdsVmZzd4YL+HT3kg24sRUA3dzDJXJ 6GXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Jl2x+vZS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l24-20020a639858000000b0041a5a805ef8si4205674pgo.118.2022.07.21.20.21.59; Thu, 21 Jul 2022 20:22:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Jl2x+vZS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231705AbiGVDLJ (ORCPT + 99 others); Thu, 21 Jul 2022 23:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbiGVDLG (ORCPT ); Thu, 21 Jul 2022 23:11:06 -0400 Received: from m12-14.163.com (m12-14.163.com [220.181.12.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B47191BEBF; Thu, 21 Jul 2022 20:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=6h2N+ wVtwTpvgrUCLikpNV+DWbwPlk278dYKE8sSdoQ=; b=Jl2x+vZS+vFEXKCwf+fd7 VPaMZJ5fNiPmCQawiebdcpPOMBwh2HZu2wQHc7oUotwMBJbXksFYFoGOIZBvVAW9 L5XerxDxbqjWWD3IbzGi/yscR2ouIhyd7G6vPnCqtsqweisrpLjxONQnnr9DGNqQ n9kjBgz2aofgPmY1h1apV0= Received: from localhost.localdomain (unknown [123.58.221.99]) by smtp10 (Coremail) with SMTP id DsCowABXewT4FNpivduNOg--.631S2; Fri, 22 Jul 2022 11:09:47 +0800 (CST) From: williamsukatube@163.com To: kabel@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Cc: William Dean , Hacash Robot Subject: [PATCH] watchdog: armada_37xx_wdt: check the return value of devm_ioremap() in armada_37xx_wdt_probe() Date: Fri, 22 Jul 2022 11:09:38 +0800 Message-Id: <20220722030938.2925156-1-williamsukatube@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: DsCowABXewT4FNpivduNOg--.631S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtFWrZF1xWF4ftrW5Zr4kCrg_yoWDGrgEkr W7A34xWrs2kr1jqw10qwsFv3409Fn0vF1DXw1rtFWfG3yxur47trWDZrn5W34UZaykGFy7 Jrn8ZF4Y9r13ujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5_pnPUUUUU== X-Originating-IP: [123.58.221.99] X-CM-SenderInfo: xzlozx5dpv3yxdwxuvi6rwjhhfrp/xtbBSRtGg1aEEOzvlQAAsD X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: William Dean The function devm_ioremap() in armada_37xx_wdt_probe() can fail, so its return value should be checked. Fixes: 54e3d9b518c8a ("watchdog: Add support for Armada 37xx CPU watchdog") Reported-by: Hacash Robot Signed-off-by: William Dean --- drivers/watchdog/armada_37xx_wdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c index 1635f421ef2c..854b1cc723cb 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c @@ -274,6 +274,8 @@ static int armada_37xx_wdt_probe(struct platform_device *pdev) if (!res) return -ENODEV; dev->reg = devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!dev->reg) + return -ENOMEM; /* init clock */ dev->clk = devm_clk_get(&pdev->dev, NULL); -- 2.25.1