From patchwork Mon Oct 24 11:30:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9000 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440032wru; Mon, 24 Oct 2022 06:03:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cT5DlCpUw40E0VibkZ9agf9fkGCr/Y1kjBL6qgNnoZZclwL7ohdKAAKRqcCLGuY8OOlmh X-Received: by 2002:a17:903:50e:b0:182:631b:df6f with SMTP id jn14-20020a170903050e00b00182631bdf6fmr33562630plb.66.1666616620024; Mon, 24 Oct 2022 06:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616620; cv=none; d=google.com; s=arc-20160816; b=gpUxBAMtrE3rwfin4BZuNvYkbhcjhCg+MHz6VWtAv2ry9KT9zb+99C9G+ri+DWEGnr ONubb96++59ApJ59eXX1NdHhnRxACc5DzPdUSK3TDr1JuUpYlDcf66yCS+mfUSeeHWPy l9T+zkHf1iyWvl7SjWyvY6XX8MEZJH/k6gVF2epiMsZD3pp5Gbn1QxFSu+27qyR++EAi C+evfxCf/JwqMDK1LeKXse0oDhsE6trVxRFF5tJX5J5JQXPeMNUwo7Jm4ctASmIre31f ZZdO2zFZn6nz2/0YfQJyYVWVtgDSKGCSN8j3jloUtyZZq+lxSLALgvwkEZvgnXv4OrQ0 IxTQ== 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=UwvvAbW53sou3hvf0KN9OQkQ/haXiDNVacFIRHS5hQg=; b=SGlpJXU+nAZ+1cdoJH0z5u5XXY3e7+cZescLMDYxV0CsjlNT6oSbx/tIGzPhk4B7qn INw/hoSEucxI8kEjI8TYS3rpxlgdBW+C578UgAuHEssJyoMy1RNhjpgqGoFdNZzg4lF7 7FtLrs0SPQ6FTSqQtK78eaXbM99mHNnRVulUWSphYL83h7Ifuci4JQriKW1ImHyCTkmE Jm7hadWfsqmMEEAO6crYQhU6TXSmCP367sB/YzZZ9xC0P57b0rISvEHqXP3XLu8xGo1s 1Eit/R4jnrgqJZ5FjlCi/j3HJkNs6Vu1m8CbOTo4+bQeH6TC07nGnzycxFdardJL4eRh aGbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TeH3tk2U; 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 hk1-20020a17090b224100b001fd81d07d0esi18617569pjb.123.2022.10.24.06.03.12; Mon, 24 Oct 2022 06:03:40 -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=TeH3tk2U; 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 S234987AbiJXNCh (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235176AbiJXM7d (ORCPT ); Mon, 24 Oct 2022 08:59:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4501D79920; Mon, 24 Oct 2022 05:19:03 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 67D3F6129E; Mon, 24 Oct 2022 12:10:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79665C433C1; Mon, 24 Oct 2022 12:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613442; bh=JIglXPERcfYhEFaXJE8sshooRMTJ9fVV8Yw7NNMupAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TeH3tk2UbqQVssInwYnYbqov1800GjtedHXLo9iTczJZZ44cfERjlkP6ATD1dZAsJ oWFNU0kI3dC/pTX1TxFRTJXK6/89zeiXBaX7pWBiJQ4ptZQ9m6U95ujIjk26cIjWt7 aO2Z5dH1FX2tlKcpsKdd6PlQQ76v3eUUbOPHCTrI= 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.4 139/255] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024113007.210068079@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747574188826921023?= X-GMAIL-MSGID: =?utf-8?q?1747574188826921023?= 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 eb0f4600efd1..40f9b6dffe3d 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)