From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 171B43016F1 for ; Thu, 30 Jul 2026 13:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785417619; cv=none; b=p11LBF6FSMVHgqsItzQX2AtBdiJJy08VoqPTeF1hp42qdxvtg6bU7rgownYKfDjd/c7vV4cJS+jXGG0NtgSKQwXhwup2Ta3Pw69FeHSdRocmUATx/WhbMeG9W8jQoRVhhdErkb2RJPPkIewxFbqjy8HoFSotNCOZPsAJmZC+Vk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785417619; c=relaxed/simple; bh=ktNtVREVtvw14E9oPcdTjRFe7oEzP1Nq9rcvXAgNTus=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=n1YTNQO2/ldbYcwUvHzUfLFP55jypLbQ9uRXjN/GrzzcfK7+pUO0rVrm4Dmpgg8/G9p4OHfWztDskbwVruQtkndNA3k9c8OW+2NclnobuoBUPRKUsUQx0pmzHj1/ufz2+nW4U1/lo4PqUcfSYa44h4NIr6q7vJcR9aJYLGb4aK8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=DxpNFXk7; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DxpNFXk7" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785417614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=uv0kAIL1LmhYJ4Q2+6EB2NTZQ1HT4I90lli19kiqKZY=; b=DxpNFXk7/c0HiltsfhtxIhvMqW7OvPl5lmXo+qLujMrhfCnKXTpORnbWa/pyDXKGWTZRJp bjQZ4bODATuRaHCeItL6wujqVJuLKau5DWOxxt4/seoM8kYHefzQfca3VPOC4AQr4F3W5b CB53j48EiYieui6X/zp3y/a+rndbqx0= From: Thorsten Blum To: Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Sourabh Jain , Aditya Gupta , Hari Bathini Cc: Thorsten Blum , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc/kexec: Simplify kdump_extra_elfcorehdr_size() Date: Thu, 30 Jul 2026 15:19:40 +0200 Message-ID: <20260730131940.597739-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1343; i=thorsten.blum@linux.dev; h=from:subject; bh=ktNtVREVtvw14E9oPcdTjRFe7oEzP1Nq9rcvXAgNTus=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFnZ/jmbZ36/ecfVM/OAqc3BM4q3gyyDc7e7Cn4u+fshZ WFa+xajjlIWBjEuBlkxRZYHs37M8C2tqdxkErETZg4rE8gQBi5OAZjIQzZGht7zyyPUXsZc6fix ucPwde5hbr3/z58ZSyl/yLvPdq91iQbDX8HWwI12uz9VBEdUyez18Fpsc47juXB5iXhV0Levct/ 4mAA= X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Return the size directly and drop the extra_sz variable to simplify kdump_extra_elfcorehdr_size(). The two warning paths now fall through to the existing return 0 at the end of the function. Signed-off-by: Thorsten Blum --- arch/powerpc/kexec/file_load_64.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index c3503d698428..d0c544079e03 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -377,16 +377,12 @@ static int load_backup_segment(struct kimage *image, struct kexec_buf *kbuf) static unsigned int kdump_extra_elfcorehdr_size(struct crash_mem *cmem) { #if defined(CONFIG_CRASH_HOTPLUG) && defined(CONFIG_MEMORY_HOTPLUG) - unsigned int extra_sz = 0; - if (CONFIG_CRASH_MAX_MEMORY_RANGES > (unsigned int)PN_XNUM) pr_warn("Number of Phdrs %u exceeds max\n", CONFIG_CRASH_MAX_MEMORY_RANGES); else if (cmem->nr_ranges >= CONFIG_CRASH_MAX_MEMORY_RANGES) pr_warn("Configured crash mem ranges may not be enough\n"); else - extra_sz = (CONFIG_CRASH_MAX_MEMORY_RANGES - cmem->nr_ranges) * sizeof(Elf64_Phdr); - - return extra_sz; + return (CONFIG_CRASH_MAX_MEMORY_RANGES - cmem->nr_ranges) * sizeof(Elf64_Phdr); #endif return 0; }