From patchwork Mon Oct 24 11:30:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532147wru; Mon, 24 Oct 2022 09:07:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QYe3873e5woJ5rjFaKNkFWKQoNpijyf6qkwj3bPVbUTl6+irmcqfHtEHRORk7eOvfwOwj X-Received: by 2002:a17:907:2bf6:b0:7a3:6230:dc53 with SMTP id gv54-20020a1709072bf600b007a36230dc53mr8819808ejc.82.1666627653379; Mon, 24 Oct 2022 09:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627653; cv=none; d=google.com; s=arc-20160816; b=eh/sbjkybv7mZprGML2kkIUXSEYUTEfPN+FkxkCUwOxS4QNB3VZkjkFbO16U6sr7Ex yvp7RCaOOyhZ39WAkQtPD31PcFJi7/EU5M1VvqblbN8zclsHw8ASZPPgZtbM9kTA0uF0 eHHQoWcVx4Wckb1iHN3gYsAyWMXV2CSJKzdBrs7U8waf5g1jELAujL8f2CqngGSrRfIk kE3TEGn7sKUWOMppOMeQJQYfnRE6CdbzyClkCHdDzWbfcrHYroxqQ7R09THB5oeDYLMZ 3sQXYTOWss+r2sucYtMWXmc4rfPIQJtiLkdqArKlzS0RNIcCgsvTu8QGgnA1RO9A4CfY H0jw== 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=yJTDbUocVtm54R96eiJ/S+MiApcIEEjtkAnY5OaZ28E=; b=Vgey7mobYHZd/wFDlZz/iH/jwqITa6tNxjTSsoR+4LQaozWViPpJwQeNReeowEOJRr sFaEq9gAG7RzCUcboPyjz5hwMYPSfsE072aUCd56jietDK21aUqaq0bsCPJzVr9iBHnB 2qBp99I2hOqAwUa6cKbA7ShCFiiSRPy8LXhKLxsUtAMDWelPKhqWJje2xXtlh8ZAdVcO lo2e/xnI6X1J6YYNObOtyPhx1ANoR3Z38uPCFpiRkMZMCodOexdHjW++FJm4lyHl8kOL 08dc24DCMda7Y24eEYaN0ThGjN8l5FDPt8g4j1az/7z+MjyuvJ/+PqaDH2ZwXph5T2bF IgAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hl9GUfh6; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a170906410a00b0073d710fec77si123314ejk.251.2022.10.24.09.07.08; Mon, 24 Oct 2022 09:07:33 -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=@linuxfoundation.org header.s=korg header.b=Hl9GUfh6; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232740AbiJXQC5 (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231805AbiJXQBl (ORCPT ); Mon, 24 Oct 2022 12:01:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40A3415A30D; Mon, 24 Oct 2022 07:55:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95709B81370; Mon, 24 Oct 2022 12:26:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB0DFC433C1; Mon, 24 Oct 2022 12:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614413; bh=rJH3zizFjqKudqIvJyk0lbrW/rBqP46moprTTgXiqOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hl9GUfh6HF6I4ZAFO2NmOIDVGsIowtwvV6bEc85D0/Vk7d34LboH0HwG00v9BwXCq A0UoIAmNHX2n0C5y21+pA57OvjQH6tWuV7xrfLVOvhsqkjaPIXUuFjs74fEVbE/6wt 6qCncW4DruDE1EWLFV8SIQjD8sEg6I08TvTNVKzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Miquel Raynal , Sasha Levin Subject: [PATCH 5.10 221/390] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Mon, 24 Oct 2022 13:30:18 +0200 Message-Id: <20221024113032.188949508@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585758523574510?= X-GMAIL-MSGID: =?utf-8?q?1747585758523574510?= From: William Dean [ Upstream commit 26e784433e6c65735cd6d93a8db52531970d9a60 ] The function devm_ioremap() in docg3_probe() can fail, so its return value should be checked. Fixes: 82402aeb8c81e ("mtd: docg3: Use devm_*() functions") Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220722091644.2937953-1-williamsukatube@163.com Signed-off-by: Sasha Levin --- drivers/mtd/devices/docg3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index a030792115bc..fa42473d04c1 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1975,9 +1975,14 @@ static int __init docg3_probe(struct platform_device *pdev) dev_err(dev, "No I/O memory resource defined\n"); return ret; } - base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); ret = -ENOMEM; + base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); + if (!base) { + dev_err(dev, "devm_ioremap dev failed\n"); + return ret; + } + cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), GFP_KERNEL); if (!cascade)