From nobody Sat Nov 23 21:52:50 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 7F4812123E0 for ; Tue, 12 Nov 2024 10:15:10 +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=1731406510; cv=none; b=hCZ9bJFzJEdZX5wF3qIFCv2bfp2ORBE2fyJZdA02MyhBWo/gFoNePjTS2uumACkkj3GWOYf0huPah8vs7Y/mrBuImJxD4TtX06t2eCq1UUP7BJ8NTpSaxDgUgGbbPa/v8RiB7mDE2InQ0J+j+2KlC8UQ+HgGX2tz8jLnH8SEaPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731406510; c=relaxed/simple; bh=u/evd6VNZ2Rw7eUqK3iewtjOB7zhkG2fVMmc7C1F68o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GbzTccTysauMAodjFjI9/t9jNm6RbQkzB3BjbAmGnLgfFgtjjHnEXzW4jsOO6p+uP65N7VHdu6ObLHXtuQRUQHgrHQF9pl02NLHhz9NzpQy8+JsO/2BtsGm5eRPLoCNuAcc5WKOrRnBKxVBNXyTCyPAPFk0wDo5Tct0bqQaQT6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o3gi0WvQ; 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="o3gi0WvQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5432C4CEDA; Tue, 12 Nov 2024 10:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731406510; bh=u/evd6VNZ2Rw7eUqK3iewtjOB7zhkG2fVMmc7C1F68o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3gi0WvQopWRICupoKmFr1/G2yy/lvOucpAxA8nWQzbkX4ZUeTDJzOubk+X766vx2 p+oLh57elIvjxVJMFIuOIeC78GigrKvOCWWrEuOykkcxAiVlHtbmLJcofis3J1zNkx ILcVDTEZWbYM2Pjamz8HIRVYG7elsqcbUc033GvbmeLYgXruwQWx0PRhAGRGwHLqUw Pns7tbck44vXxBgM4Q+f8Nskxi7UkO2UoHvlPQz2hrKjumVne3NYADH9JNB4757jyb nDLjJ/ZNOZq+q9yIT83p8sMJbX1ajs7hZ8JsMHLifyksUdpVGVcO2LlrXLclDsdo6t Q7LlqB7lDbDiA== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tAnvP-00000000Jch-03JF; Tue, 12 Nov 2024 11:15:07 +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 v3 02/15] acpi/ghes: simplify acpi_ghes_record_errors() code Date: Tue, 12 Nov 2024 11:14:46 +0100 Message-ID: <285ad59f9643a2b39563c8e9b904be94379f9947.1731406254.git.mchehab+huawei@kernel.org> 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