From nobody Thu Nov 28 15:55:05 2024 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 0405E1DB55C for ; Fri, 22 Nov 2024 09:11:50 +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=1732266710; cv=none; b=jI+WCxxPcg/oBcTJwU7DKg0ywguFSn5GNDTZYdJmxPubrRaRJ8d/st5ri+2hIl1cMPySGp7ideC70tfa6pVYP+QH2JyaxAXHzu3fDpaKTYJXrqgE0zxUPYO5+b1Dk6H+xuzumNtyRFcmPY2Eam9sJloVG7lmre0vj6F8ARO/UrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266710; c=relaxed/simple; bh=u/evd6VNZ2Rw7eUqK3iewtjOB7zhkG2fVMmc7C1F68o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jjhDCwP3zG+2JvYwAqlABbooIVTWaaGHC/3PjAUvZGRd994ez86sumEEBHMJUjP94MXLpoWmBkoDNUZUQi8m+92JhIWkKoPmXsqaUYwEAaVArfw7CewRgaeSUDS8GmsTQcM7akh6lLfaoX57RfzOdusKMLIt8FqFo3PJt9aCCSg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=flVnF+G6; 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="flVnF+G6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D637BC4AF0B; Fri, 22 Nov 2024 09:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732266709; bh=u/evd6VNZ2Rw7eUqK3iewtjOB7zhkG2fVMmc7C1F68o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=flVnF+G6K8xjTew3rEgHR++AelrZMDjgU3036bxDCI8h5y2sMNwqOk3vssUBpyv9G KSrSZnsQjDuwfpRXw6bv/WGP5c0K4VSYe3aomKTXRTzTB/t0mVnskkrYcE0TTqohTN LeSkTJiQsD1WQZatNTLt6CW+F0kxBVsPMXnSOioCcpSEq3Ql/tFAXVamAM/dhx6AKQ AjMgwC9v80NnOHOFOugI5hOwoS5XD/f9g00j9JXcEKE/qmjmAjPt1x/WHnKPQVgtYn QK2nPXMTlAGf7q0LSj7c/g4yTE6o0LUumPf6QJsG81nOMDDssbh/R5j+EbQkqj+giC prW5938O05CQQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tEPhW-00000006l3b-4Am5; Fri, 22 Nov 2024 10:11:42 +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 v4 02/15] acpi/ghes: simplify acpi_ghes_record_errors() code Date: Fri, 22 Nov 2024 10:11:19 +0100 Message-ID: X-Mailer: git-send-email 2.47.0 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.0