Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3654719pxb; Mon, 24 Jan 2022 14:32:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgSM9u+lr0xlNm619XNu+diOzxwX3a+9b+G4pEEQVcevmkY5qpIwrI1GmCroM0zwCyDc9e X-Received: by 2002:a17:90b:4c04:: with SMTP id na4mr461554pjb.62.1643063471842; Mon, 24 Jan 2022 14:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063471; cv=none; d=google.com; s=arc-20160816; b=nZXEMZ7J22ExOgBEiOcTDOwp9GoWitz15rnnBzpHrqdsN8G7B4IZRDsKBYB0p7NP7e 6lxFJnCeXgCKO0aPOiJ7WUzmC+4aecTkFPOuxn9GFd8LWkE84EZtLJ4wNgTjA9vPL+2F /XREwt9CscVMGexWKevYtSL+BtZtreJBAxbIpsuAkhEJ5mhx1ISHzFWcB3rEY2qCUvue t9UloOmDCqi1EvbwLFVrPG93dzMWjjoyoGSAUZHZ+QnCzzagNiFIAhxSx4HAPv3jzsNI JZIO1QpY4Kwtfmr6tct2rJ6ZgloFa8JWwQQR0J4M98/C3mcMFv3EnoiWVbZwCIhXnOSv vxcg== 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=/P4gd2hEjqSzEU2zyP9g5YywqPkAG6TKibToQyrKUAQ=; b=a5P7lm2UwqHjoaCtCWVcA4IimZtrCF4YQmyC6Jl/fF+/90Fvl9kM+mOh/JcgC/walo aB7LVgN+pGqsTohJR9DJvh4creIBKIHDWI+mXLxqcDE3YpVvvF4WWbTBVwBMw/SO/Ez5 +Uzs1mP72r3MUxhyWkoMWahjIrDEBfsxlKL9pPGnWuIrC8N1e+VG11z3NS6de2t1EkyI ppg831rhGEon56FiFBzHMVkDiziUYsVD+kDAplv7yGqZ7gHTkzJb/fciXAVMsnqfg3FU vrFXhvpIx/JgEYQwONml+ijE01ys+SH/ipRnar1OxAY7M3PcpB2lZVR9mFmVADTXdeM7 XgLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="waw/eDPT"; 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 m20si1620867pfk.347.2022.01.24.14.31.00; Mon, 24 Jan 2022 14:31:11 -0800 (PST) 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="waw/eDPT"; 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 S1586777AbiAXW1S (ORCPT + 99 others); Mon, 24 Jan 2022 17:27:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:33566 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447749AbiAXVLZ (ORCPT ); Mon, 24 Jan 2022 16:11:25 -0500 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 261EC61469; Mon, 24 Jan 2022 21:11:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D338C340E5; Mon, 24 Jan 2022 21:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058684; bh=38QJKayBH1t+mBmsiqgcjzBj6O8WHMCZs2mmLV6jwwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=waw/eDPTsH/Chl2wRlToDbxGqaLUHbiBBcd2COlRECu4qNNLeD/d1xV68vuUTdhDd ukPhJ1Hvvd5e4Fvh+skoXhfmj0uO2R9+rVf49d395WjrYCha4tgmQ2RsfYw3LZjJ68 FM54uUd8UWyOgXZOiaeeLg9s0shdFmAgw5qnoOGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.16 0367/1039] power: reset: mt6397: Check for null res pointer Date: Mon, 24 Jan 2022 19:35:56 +0100 Message-Id: <20220124184137.630019912@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Jiasheng Jiang [ Upstream commit 1c1348bf056dee665760a3bd1cd30b0be7554fc2 ] The return value of platform_get_resource() needs to be checked. To avoid use of error pointer in case that there is no suitable resource. Fixes: d28c74c10751 ("power: reset: add driver for mt6323 poweroff") Signed-off-by: Jiasheng Jiang Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/reset/mt6323-poweroff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c index 0532803e6cbc4..d90e76fcb9383 100644 --- a/drivers/power/reset/mt6323-poweroff.c +++ b/drivers/power/reset/mt6323-poweroff.c @@ -57,6 +57,9 @@ static int mt6323_pwrc_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + pwrc->base = res->start; pwrc->regmap = mt6397_chip->regmap; pwrc->dev = &pdev->dev; -- 2.34.1