Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp598341pxj; Tue, 18 May 2021 09:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOTyjW88MGlcORiqUWC5Ff1sJkjW2Fw90ZOfrVO/LluFP+a7zJvZWw0OF6FVCzrct4mcnf X-Received: by 2002:a17:906:2a56:: with SMTP id k22mr7101638eje.551.1621357136480; Tue, 18 May 2021 09:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621357136; cv=none; d=google.com; s=arc-20160816; b=IhyG+UYraFpc4H+4IMHMqIbU3kfiIZ+3BmnUTmDhJ+l3cpH6aW/nu6NBLo24n36k6F OHtb+TrwCaoVdidv/NFbSlg9d24e2Xc7DAan+NOVg/7dYgeG2bMQ9bI55d/Om5EawvbG y+bFRLryYLDK5x7ubFMOoPTlr0KW+4sNmWb6Tz4aY875Z5JVyvLdN342EePQTifMENf9 3l9c7GsMmVs6rt0vYf4ubMng6YVqFArBgdmp60NxB2IRSU3gZbNov02CizN7KQ/vxFl/ g3yUr8tOb5BHteHpVpvhUri8DmqnJ85MbATcdbHUWdv+4KsJyqckkawfMqZLveyfq8pd jUNw== 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=FwE88RnmEaCWwOPCN1dY9mYirxQEF/q9tbGbhHlquyU=; b=N/5+Y3pDtsNQDQuHwpCSSLsfZvBEj/HlCnUf2oUgPEQ1U81SDrwyo168IjAyh7xYZE diSH9BJ1J46KXe/oKrJWQewFeyEc4ZI890+JwDf6eZ+c1WW2d0HRwp3JUKweD+yMp5wL I1H/OuxJ4mhMNZbBusEx+pGKVouSCG73FwZ/T5AZms/LOgcHBmESeDsBfWhwWWsSlznw lLXb96kIAU5f2pOElOg1RMuRQaC7loP9sHw7euJ5PD0CbrKOrMTuPWG24+G+hCUxkIJS VXi2Fr5YnWIcQr83ptXQhO/rFZFjAa3X/JH7xg2UcRq41MbHLaVgzVeqHnIX/wOk1a7V jYSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="npm/zE1w"; 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 b64si19472964edf.308.2021.05.18.09.58.33; Tue, 18 May 2021 09:58:56 -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=@linuxfoundation.org header.s=korg header.b="npm/zE1w"; 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 S1346203AbhEQQEz (ORCPT + 99 others); Mon, 17 May 2021 12:04:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:52062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243746AbhEQPoB (ORCPT ); Mon, 17 May 2021 11:44:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 056A36135D; Mon, 17 May 2021 14:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262584; bh=zvP5z3xHUUP8GpW6ufPFOYxcKv8Sv1SSyqT4M5368b8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npm/zE1wONcONbeAjSV9wQlNQnjiCIMlcliFskEDxgOwrNd5BPspXdCtAcUs5KRfh jtE74VAE/Esegq7+U/IWp79vAeHlaYQ3dVOcoyKgsirI3r6sKiHkjhDpHalfSr2qPP aM0IoNqexBsZ2ieLZuKURMzXbQc/mAE43KDb7W6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Williams , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.10 219/289] xen/unpopulated-alloc: consolidate pgmap manipulation Date: Mon, 17 May 2021 16:02:24 +0200 Message-Id: <20210517140312.516794815@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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: Dan Williams [ Upstream commit 3a250629d7325f27b278dad1aaf44eab00090e76 ] Cleanup fill_list() to keep all the pgmap manipulations in a single location of the function. Update the exit unwind path accordingly. Link: http://lore.kernel.org/r/6186fa28-d123-12db-6171-a75cb6e615a5@oracle.com Link: https://lkml.kernel.org/r/160272253442.3136502.16683842453317773487.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams Reported-by: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- drivers/xen/unpopulated-alloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/xen/unpopulated-alloc.c b/drivers/xen/unpopulated-alloc.c index 7762c1bb23cb..e64e6befc63b 100644 --- a/drivers/xen/unpopulated-alloc.c +++ b/drivers/xen/unpopulated-alloc.c @@ -27,11 +27,6 @@ static int fill_list(unsigned int nr_pages) if (!res) return -ENOMEM; - pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL); - if (!pgmap) - goto err_pgmap; - - pgmap->type = MEMORY_DEVICE_GENERIC; res->name = "Xen scratch"; res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; @@ -43,6 +38,11 @@ static int fill_list(unsigned int nr_pages) goto err_resource; } + pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL); + if (!pgmap) + goto err_pgmap; + + pgmap->type = MEMORY_DEVICE_GENERIC; pgmap->range = (struct range) { .start = res->start, .end = res->end, @@ -92,10 +92,10 @@ static int fill_list(unsigned int nr_pages) return 0; err_memremap: - release_resource(res); -err_resource: kfree(pgmap); err_pgmap: + release_resource(res); +err_resource: kfree(res); return ret; } -- 2.30.2