From nobody Wed Oct 23 01:31: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 5E63914BFA2 for ; Wed, 25 Sep 2024 04:04:48 +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=1727237088; cv=none; b=AgGt6fWu3n4E779aCOx9wq4OSGc3aWq/W2R9OtIkuZ2I2u+2gdus4+J6XPNRsFXF3BZ8izkxfwpllhZAJ1eIcaWZmSlkX7Vrtneaijfgy7lT+FCx8b96tt/8yxlLZyTzjO6Naix8HV8RUjIfmd8iF3Sj0PSxEwPMPcWO1mFL5/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727237088; c=relaxed/simple; bh=nBKJN8HnPZNNP4hYZrf3OFUxClvSEboHXAz3CwHADyk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C+B9Z+BVX11ZPRKuaoGVxuyIR/OPXH7+ZDpW7GU9e9lb8TTUlXnLCcAm3yGef7PWhohGz550yeM+CR8Gz5Vr5CDhhD4mBo43uDb9FZ+IX5sFQ1l6xcQxpuL/z4sg1s0OyxNGtCVPxCNCNy0fMmPJER6JVWr2EIUs3pXSzwxJR+A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WEsdXcyd; 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="WEsdXcyd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06F3FC4CECD; Wed, 25 Sep 2024 04:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727237088; bh=nBKJN8HnPZNNP4hYZrf3OFUxClvSEboHXAz3CwHADyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WEsdXcydUg8hMicE2Jskh4hIbo0vjmGEWzyDKWEvYLZXkJoxJh5XRKZ81icvEoToM FgRMGwh6affiTmZ46KTBhmNe+bYuB0X/Rv2TQRWIkj4rH08e5GqqFetFfBfCL84Mdu LSVLAGMmmjTLmd+qdmOgyCIuUjmzCA9UQhNGCt4fjol8+dT2R/oihjRfQiKW9UcwJl AGCosDjve+pnfeUWpwZPx0DEGKAMSDpJeHLLVYCPRMX6Zpat4roxw+DPvjg7EWLSrH QNIB6eRmCWkebo2+TrU+y/gznJsdWNO5valjr6gR6+EFb2Jm0WjhPTueP8OHhME1fL BzbwjYwW4RQHQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1stJGg-0000000827k-0RNk; Wed, 25 Sep 2024 06:04:46 +0200 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 02/15] acpi/ghes: simplify acpi_ghes_record_errors() code Date: Wed, 25 Sep 2024 06:04:07 +0200 Message-ID: <45dcc7644e2b2a04645a37e561ed7294482b0744.1727236561.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.46.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..dacbd4d0c093 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_regist= er)); =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.1