From nobody Fri Dec 19 04:54:19 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 94AC718E379 for ; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; cv=none; b=Wn3jTxRp2cyF99YSlqO8N+9JVgZL8y98O2qKXJ2ncL3u1L4h6WNpY5IgQigCdcTYJaA1zyoIPXGikPosjm3O7n5FIutGxQEDTw5xSx/guNY6wHBJen9gDrjfowG60c+AtJ4pBJY0SpFwg14G/SbKQBMCGMpFZOiBewDEHB9imKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298153; c=relaxed/simple; bh=uDihMbAVHajyrPqIm6xCk4kSLNVBW/olOYucuqFWoPc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C8PBQdzlHWmnYzmuKdZ+RI/5a8NqnepfKvO4Wu9ytFw+owWl6QGxYhXJdbCOHgX4nJy4m3X0baoWeCntr1bxuEjh8oN+wQIiYJDP0Ddir0Lj5uj+CyeNssI6XJWJQSX3GC/R4B76+v08hyCcK9+lqAAsITlbNeVwlE0nsP/3+5U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=czQmyl+A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="czQmyl+A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A86FC4CEE7; Wed, 4 Dec 2024 07:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1733298153; bh=uDihMbAVHajyrPqIm6xCk4kSLNVBW/olOYucuqFWoPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czQmyl+AX++IkbELUJZwjAdtdZVgC05x2aD2bG8G8cyH8UJ4EkIxeya5BijhrA4b1 szhkd6Y+T/XjGy6GsrcYDfEf4IojvzwavXDeTWA5tYm/fQpTihyyC8Euc5cUbrbU62 ivkAiCgRM9+eHPJ8M6ciTzf8ZENa6hLVwFzjSrT5BEX/T6H+QaBeQiypOZrTd6CGNl Chd+0QJaJxOhJYCwtBg8xpLJfPpAwpRLxsxySDeUzNZasrtnzxK1GAXNFVWuB7tM8h Yru8jz5xY57VHWamI4xBNHxjLDvj9VOW4zbHEIruKDRkDglai7G/QZxdyUymRGBrA1 ct1CpABnhWsoA== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tIk1m-00000004Kim-47VJ; Wed, 04 Dec 2024 08:42:30 +0100 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Jonathan Cameron , Shiju Jose , Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH v5 02/16] acpi/ghes: simplify acpi_ghes_record_errors() code Date: Wed, 4 Dec 2024 08:41:10 +0100 Message-ID: <766ac4c230af004689e464f6f8a731bbc31508c5.1733297707.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Reduce the ident of the function and prepares it for the next changes. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron --- hw/acpi/ghes.c | 56 ++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index dc217694deb9..e66f3be1502b 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -402,40 +402,42 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64= _t physical_address) =20 start_addr =3D le64_to_cpu(ags->ghes_addr_le); =20 - if (physical_address) { + if (!physical_address) { + return -1; + } =20 - if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { - start_addr +=3D source_id * sizeof(uint64_t); - } + if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { + start_addr +=3D source_id * sizeof(uint64_t); + } =20 - cpu_physical_memory_read(start_addr, &error_block_addr, - sizeof(error_block_addr)); + cpu_physical_memory_read(start_addr, &error_block_addr, + sizeof(error_block_addr)); =20 - error_block_addr =3D le64_to_cpu(error_block_addr); + error_block_addr =3D le64_to_cpu(error_block_addr); =20 - read_ack_register_addr =3D start_addr + - ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); + read_ack_register_addr =3D start_addr + + ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_= t); =20 - cpu_physical_memory_read(read_ack_register_addr, - &read_ack_register, sizeof(read_ack_regis= ter)); + cpu_physical_memory_read(read_ack_register_addr, + &read_ack_register, sizeof(read_ack_register)= ); =20 - /* zero means OSPM does not acknowledge the error */ - if (!read_ack_register) { - error_report("OSPM does not acknowledge previous error," - " so can not record CPER for current error anymore"); - } else if (error_block_addr) { - read_ack_register =3D cpu_to_le64(0); - /* - * Clear the Read Ack Register, OSPM will write it to 1 when - * it acknowledges this error. - */ - cpu_physical_memory_write(read_ack_register_addr, - &read_ack_register, sizeof(uint64_t)); + /* zero means OSPM does not acknowledge the error */ + if (!read_ack_register) { + error_report("OSPM does not acknowledge previous error," + " so can not record CPER for current error anymore"); + } else if (error_block_addr) { + read_ack_register =3D cpu_to_le64(0); + /* + * Clear the Read Ack Register, OSPM will write it to 1 when + * it acknowledges this error. + */ + cpu_physical_memory_write(read_ack_register_addr, + &read_ack_register, sizeof(uint64_t)); =20 - ret =3D acpi_ghes_record_mem_error(error_block_addr, - physical_address); - } else - error_report("can not find Generic Error Status Block"); + ret =3D acpi_ghes_record_mem_error(error_block_addr, + physical_address); + } else { + error_report("can not find Generic Error Status Block"); } =20 return ret; --=20 2.47.1