From nobody Thu Nov 28 15:35:24 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 6C0F31BC9F4 for ; Tue, 1 Oct 2024 07:04:11 +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=1727766251; cv=none; b=bBwbazV9SDc8zrz6mAOA68FW9nkBot7yp+yyddkz11k2rVrmYEl4FHkA1C4knNlCDTEN129XlhoqNO6vhSczNngSI72zIK+tvvjHaDdrXNAzjm0U4uHgBv6UCO2TpMDYB8Y4ujcPAxJVzCKV8RqYk+5BsieYrmdN6GCe68ff+Lo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766251; c=relaxed/simple; bh=zkop42TFRLpY7ULuyBanfVruQ6JbCYVDcuNKDW81Y1Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ozwatxfBA/+k1ddfbMFWVE0jbugGO8qGv+/CK5wqupqk+nrKlF/dBNvwqwkVqFPyzj+oVCTPnJc1tmCUAfPBLbbAOABrFreIqzF6eiYfWFlUFtd+v2SuLEQHdgG/PkyzeMLklPJWL81/7Hl8cTdLkGzWoU6kGdqFbdwvF/1mZBo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WKhB7puq; 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="WKhB7puq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10C82C4CEC6; Tue, 1 Oct 2024 07:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727766251; bh=zkop42TFRLpY7ULuyBanfVruQ6JbCYVDcuNKDW81Y1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WKhB7puqWLjWEh5WYvXQE0rTdVWeDN5LVjylm2JNCfGw36C9B3RgdhFiU3pOOCOdm UYkHmf3N84IWPAUUY8Ks+bbYzR/PPqrpiyKYOI7DWDlSunSKxboSq7rqteYSBdtrUZ I7Q6CTbB6gi82Au7iP5bFOEjLAcsubfHBtk7DRTpWQqrotb6bxTZO+1V4eGacC+/ro fj12AUupWZpyJ1tBo+2qbf68QpVgImo/KgjfsZNrPRD5aMpDGAGY/CDqR3RzasUg/o jXCmypQ2pCc4BIft6xZraHM06VFVMlE+Er3RfiFgtXm5n21ogDZChIqSV4y2eNjkD5 5v8GJt3FzyWHQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1svWvY-00000001V0R-1Rfk; Tue, 01 Oct 2024 09:04:08 +0200 From: Mauro Carvalho Chehab To: Igor Mammedov Cc: Mauro Carvalho Chehab , "Michael S. Tsirkin" , Ani Sinha , Dongjiu Geng , linux-kernel@vger.kernel.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, Jonathan Cameron Subject: [PATCH v2 02/15] acpi/ghes: simplify acpi_ghes_record_errors() code Date: Tue, 1 Oct 2024 09:03:39 +0200 Message-ID: <3c7830e2db3aa2655db0487611c853728a1dca54.1727766088.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.46.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.46.0