Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp223276pxk; Thu, 24 Sep 2020 04:12:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfDBAWwZhEQI06ZhfPGQhE6mBe42uPcjnxrlaPqrsHeCm62RhhYnQwScDr6YoPaAxR369z X-Received: by 2002:a17:906:850e:: with SMTP id i14mr448713ejx.168.1600945973533; Thu, 24 Sep 2020 04:12:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600945973; cv=pass; d=google.com; s=arc-20160816; b=OElBWXFGD/hlLFO88lokzCQMmIWyWBFgictAXDm23Vlv7xIV/w4vMDOpOnikS40Ph4 IOmfkd+1wWwEcqMfJFNDonKAlMkfVNirzfbXP/l/QZ8roAb2+Os793XBmMKKoRTbfNVQ LsXZoVQOdI+fvgaKHlldQWNLlgYeF6PGr5rsrLVpC0vassjwJZWENmyUrRCCvqNSBMnS bN3h+sz1cPyYF0zxKQCSdRkxL0O57GvIHH5iXUHQL1lvnk7CgRGa9cn/NbjoTJ8s/YeA oLpZ3qumh40ot8jPP2RjCK6wVx/GOsmzHJiYAG/W2Ib/ffNd7Qf/bGd2r7QPOKd9umSB w/+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Acz77/pflNcVdEV1U42qoD+DQZydsUzkqwBd3G+9rkI=; b=qMu1C37U6BNW8TPrGfq+1MhALcxdahqytFLhVhxypqIUu0XH3IwRqx1nRkMKLv7/Sd omPLVHZB8einhz5hhnvQcy85lk97/zcNvZKMnaYOLSjGVsf135w62UvTEMQl8+IKmLvf u+Q+nRcX0RSphZJtDwgO9LhZ9O/oi/LDxQ+5lR9uU7pmEBK5oWWnNCDui2dGvR4t2b+w V5k7bryNbCYXGCrdMN40ahkCXhdrM/1+RYtSTmhxJXdir5aIeFCgPzdrmkM2e/k/VgQp Y39diebfOKKfgM55gHf8sKHLEKYmdhpk8bN75vOWF8HD8IXg9WKNMI18xV/rHQFYSjYA pDlg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=Jk6IOAGo; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); 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=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr7si1479442ejc.447.2020.09.24.04.12.29; Thu, 24 Sep 2020 04:12:53 -0700 (PDT) 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=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=Jk6IOAGo; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); 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=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727422AbgIXLKg (ORCPT + 99 others); Thu, 24 Sep 2020 07:10:36 -0400 Received: from mail-bn8nam08on2080.outbound.protection.outlook.com ([40.107.100.80]:53920 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726415AbgIXLKg (ORCPT ); Thu, 24 Sep 2020 07:10:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bI6sZj9pjliX3u3QjifeWsBYi2gdtehhL8OkVFqpYWLP+Virgb6RRd4CXIbXrxdAQvnYQFC7fqA7heLKSfXXa0EvpJdq5qOUYdxBRmq/nSqP2ErAT3NbrwxjyAYe4mZyT+tKazfEiZ0/53leSZyVDC4BD5hbX7U1XMy7/AZJxeUlr/L2F17fosMJeAcf4pg0q26KcsuLB3e9Uz52456KtDdhtKtY7pBMzxmy06X63j785aA+En3tQ652JJpsQp2uw1svdesQkOx/ByXgVAZQxLjZ0IktY31EbWqaJpYmKREBNpcVbWvtqkftlq+yCWsynlGXvdxEDw8fIngGe4l0qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Acz77/pflNcVdEV1U42qoD+DQZydsUzkqwBd3G+9rkI=; b=VKZN9Pjtfenp30Da1UlrbguJvYtahjcY19Mhcp0DYEbt68GTp2h+anXqerIMMd6UrBMyK/D5jknakNQ6juAryvcBH3dBSATeJxFV+yHVHxmPOJz6biz5zVZoZuDoQLWaqTRQjMo1AvUMEHR697xaJqxOCDfmrawRME8TgXHu4YIPeKQxQZmGGeK59BeoHZoRsflIdj5zIxa7rKcCCYlQy7b2Tn4zckpSMQvhRtADsK711GCUa0AI33X6j2ONO1z932kkZ5YTuSirQheWXbGamPuA6brryYb4yCkQFelgv4rrPbGDQ42Dao5JiOeDMAPIaYB7nhkMhc2fFr5/kh878Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Acz77/pflNcVdEV1U42qoD+DQZydsUzkqwBd3G+9rkI=; b=Jk6IOAGo0hMtAydUGk9ZxtjtDZdCUH85ScOE373R27xi1fxiFBSdoEk4yIQ7P8RkRQJN1OrNtZ299rFBNrOVRKei6Qs5nVeY+75ZnYm3roShaCxI+zDBwgPrkRSkyDXtBDTG8OjZcESVVq8WiaqjAMITnXYLezE/VMuedOzdC18= Authentication-Results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) by DM6PR03MB4698.namprd03.prod.outlook.com (2603:10b6:5:180::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Thu, 24 Sep 2020 11:10:33 +0000 Received: from DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38]) by DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38%7]) with mapi id 15.20.3391.027; Thu, 24 Sep 2020 11:10:33 +0000 Date: Thu, 24 Sep 2020 19:06:23 +0800 From: Jisheng Zhang To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Jingoo Han , Kukjin Kim , Krzysztof Kozlowski , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Yue Wang , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Jesper Nilsson , Gustavo Pimentel , Xiaowei Song , Binghui Wang , Andy Gross , Bjorn Andersson , Stanimir Varbanov , Pratyush Anand , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masahiro Yamada Cc: linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@axis.com, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 2/5] PCI: dwc: Check alloc_page() return value Message-ID: <20200924190623.3251c2ac@xhacker.debian> In-Reply-To: <20200924190421.549cb8fc@xhacker.debian> References: <20200924190421.549cb8fc@xhacker.debian> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-ClientProxiedBy: TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) To DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (124.74.246.114) by TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:10:21 +0000 X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Originating-IP: [124.74.246.114] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9297cf5e-76d2-4fea-a169-08d8607a7492 X-MS-TrafficTypeDiagnostic: DM6PR03MB4698: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t0btgccwOGojDdAaCv0wgZnNV7PTN/TCuiwSg0FB6OVX9+F/Qk8dnVynC0N31ulPlq3OK5gCgp44WWNxEnSV0PwsP9v3PVu0zV6g1JUPI0f5GT7nzTg81bBOnkFIXUXO3YY04SJ/NSx3MCnY/ZVbeMz6sb6xRQZMma311tRKdi26KUVdUEAFx2dtCLuUfzcqoWyKnj6mIHDu1JGLO4I/mHphOC18G7+HqsJXMbJSQ6vV/oi0W6uapMruuD/ES3esOyT/NIcQ4UJKI+zroy6IsZYx6ZEc9+Fq/6BgiibfIhq3NECEqOzXFvRL9iPGbOrQZlZEQHDk9pvst6dItYg5FFzbZy8/UJXzmEA8NuXLWxV0lB2jT/N8DLb8SkgfgCyX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB4555.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(366004)(39860400002)(376002)(136003)(2906002)(86362001)(6506007)(52116002)(7696005)(478600001)(5660300002)(186003)(4744005)(66556008)(16526019)(956004)(1076003)(26005)(316002)(66476007)(7406005)(66946007)(9686003)(55016002)(8676002)(8936002)(110136005)(4326008)(7416002)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ThZuJR8ax+hGtWKFSItGEbCRsjR1hkm8jqwn6FE6pwMjVlNErjiiAw7/3GqWJMZKyZ/xBy2Wo0ARd1VoDZCzNPQuzumlhDOnebY0LKZV38005FjqPYn8wAq/X1bzIven6vOjB+UhHJqlAbZjXyafJ3RQajm05duMupTMqWOkuY0iDTwBP3FUEbo/QAlCZlsQL9IxfDp7LRaBxyvF6sJJ/td832GaqDajF5Kf6AvYGOhxIorC3DgXiCeqT8B7nqGcNEE7scN1UC1BL6vGZ9d/YA6DudNV0Fe3b2b0BuMt7pPehY6KrF1VnGJykbExDFHfnF633KEo2FhlswFQek5byOtC5Ay9luGHpjyvfIywmTEaC1oHy6JerSI2ebDIZaksi7LaHUt64bkLgxcKCHuycCWJYJ46sNgMXbbBAKh8pffyhEE/xST/MH6RQejJTAn4GIxz+c3GsVV1V2jGTYMJjvxddIxyZ1XFBZB5wprziBlbaKcyk9HqvtaD0bwef7P9EifDYdi50jZObmq1ZuiwWiOGtq8TY0WzcQChFZ+nVPsMLmgjv/SurcIeC4Ej44zKrk4Z/IO6zsD/39NxBYW3cbam/i6XC8CtPiXjUIwgSjHKoMh3W0xHMSdHeED0ryVopEar0gaFYmk8a+36QHcxXQ== X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9297cf5e-76d2-4fea-a169-08d8607a7492 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB4555.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 11:10:33.2917 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0KdVNy1pp8q56TtyKEyqSK+JlCejxU8JAZeVAODVEtdXvVukYoN8MgZuqQPhZRWeP7SO7vx7BL8tuKJ6tiJ0yw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4698 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We need to check alloc_page() succeed or not before continuing. Signed-off-by: Jisheng Zhang --- drivers/pci/controller/dwc/pcie-designware-host.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 0a19de946351..9e04e8ef3aa4 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -303,6 +303,11 @@ void dw_pcie_msi_init(struct pcie_port *pp) u64 msi_target; pp->msi_page = alloc_page(GFP_KERNEL); + if (!pp->msi_page) { + dev_err(dev, "Failed to alloc MSI page\n"); + return; + } + pp->msi_data = dma_map_page(dev, pp->msi_page, 0, PAGE_SIZE, DMA_FROM_DEVICE); if (dma_mapping_error(dev, pp->msi_data)) { -- 2.28.0