Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3655412pxb; Mon, 24 Jan 2022 14:33:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwF9oNX+0X/04JQRVb0w/CQp2Tm3rzLvZ/fND3ABXsTo94/UHqwyQYH4HZ1d9j2sjQy0wk9 X-Received: by 2002:a05:6a00:2494:b0:4c9:f16b:3e37 with SMTP id c20-20020a056a00249400b004c9f16b3e37mr3800112pfv.29.1643063636800; Mon, 24 Jan 2022 14:33:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063636; cv=none; d=google.com; s=arc-20160816; b=q46r7qnd4MMDgithLtW2aaq06Hww8HGZzMn080iEw+Ne2/pJxn6WnrdtEOGA78bY7i BNfX+B0hf184JWDbs6NWrSj2gR8um2KnovhNgtGNACyPcXOCQ2OkcelBGhkkafCPcLpi PKCCk3+qE1x8mmTs6Ngq4i48icmoLwhcCmoXHwM9OVFZ0665pDP04XNA4aRBi+X7ulAo 73XcZ7sUwI7Q/LZXUSbpVL3ZGzCFyf462x8p3e2u7VnTjgQl9i7glM7ElK4dNcBx/gat 7ttz9FfvF2Beh96dsyBZZnFhgF7OxVUKfMJZN1yPI+EtJmbrquZTV1CbLMQx2zNCJ29c 75OA== 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=Ep+BqxD0Xhp9JLU620HSjUrqsrERZtgxHhmv0FXOPulirZzYFne8vSl9/BTK6WUMQy Rkfeluqo2//osBmYpOf9OPLp2G+lgK6tUMiPz6K/8laAoLvdaU6bWMORRfjCyakjXATk hjaCcBM0+EBRb8b1d8et+fsjARdpBc2ilHZQtOvfGMC/QEvWa40fz9w0g/ABxgl/36Ka j7L5T9fdcJBR0EiaDzjB7R6ejjaRlg47ceOtVcr5yKika7JvsBx5tqqMxs6kG/9nc4RY 3IA2XusX8I/Q34lMsEp6RvrZffCh1k0QO9N30emmETS2mpnsYZ1gQQiCNkxf3xraONa6 EfWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="u/2h1AcQ"; 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 lr17si668260pjb.102.2022.01.24.14.33.44; Mon, 24 Jan 2022 14:33:56 -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="u/2h1AcQ"; 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 S1588429AbiAXWcV (ORCPT + 99 others); Mon, 24 Jan 2022 17:32:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456551AbiAXVjb (ORCPT ); Mon, 24 Jan 2022 16:39:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94069C0417CA; Mon, 24 Jan 2022 12:25:03 -0800 (PST) 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 4F2B0B810BD; Mon, 24 Jan 2022 20:25:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7908BC340E5; Mon, 24 Jan 2022 20:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055901; bh=38QJKayBH1t+mBmsiqgcjzBj6O8WHMCZs2mmLV6jwwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u/2h1AcQtXpIyc8T1IC/WPoYeqNkIk7/tb6bR+8Vjp8fxJa9/PYzB/LKR/K9X80gL HAA4tcQbweXs4vxPqhrXkegCURwCT/+PUIv0crMzNZXrYDLyO3BFBo1vi8/OWdLSDj s9B6/zaKHrEQs+0kdL8zyMP2TaYOHpTIFSPP1TWk= 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.15 304/846] power: reset: mt6397: Check for null res pointer Date: Mon, 24 Jan 2022 19:37:01 +0100 Message-Id: <20220124184111.391081587@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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