From: Yazen Ghannam <yazen.ghannam@amd.com>
To: shiju.jose@huawei.com
Cc: rafael@kernel.org, bp@alien8.de, akpm@linux-foundation.org,
rppt@kernel.org, dferguson@amperecomputing.com,
linux-edac@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-mm@kvack.org, linux-doc@vger.kernel.org,
tony.luck@intel.com, lenb@kernel.org, leo.duran@amd.com,
mchehab@kernel.org, jonathan.cameron@huawei.com,
linuxarm@huawei.com, rientjes@google.com, jiaqiyan@google.com,
Jon.Grimm@amd.com, dave.hansen@linux.intel.com,
naoya.horiguchi@nec.com, james.morse@arm.com,
jthoughton@google.com, somasundaram.a@hpe.com,
erdemaktas@google.com, pgonda@google.com, duenwen@google.com,
gthelen@google.com, wschwartz@amperecomputing.com,
wbs@os.amperecomputing.com, nifan.cxl@gmail.com,
tanxiaofei@huawei.com, prime.zeng@hisilicon.com,
roberto.sassu@huawei.com, kangkang.shen@futurewei.com,
wanghuiqiang@huawei.com
Subject: Re: [PATCH v12 1/2] ACPI:RAS2: Add ACPI RAS2 driver
Date: Tue, 9 Sep 2025 12:24:34 -0400 [thread overview]
Message-ID: <20250909162434.GB11602@yaz-khff2.amd.com> (raw)
In-Reply-To: <20250902173043.1796-2-shiju.jose@huawei.com>
On Tue, Sep 02, 2025 at 06:30:39PM +0100, shiju.jose@huawei.com wrote:
> From: Shiju Jose <shiju.jose@huawei.com>
[...]
> +static int ras2_add_aux_device(char *name, int channel, u32 pxm_inst)
> +{
> + unsigned long start_pfn, size_pfn;
> + struct ras2_mem_ctx *ras2_ctx;
> + int id, rc;
'rc' is uninitialized, and LLVM gives a warning.
The issue is the "goto ctx_free" paths return 'rc' before it is set.
> +
> + ras2_ctx = kzalloc(sizeof(*ras2_ctx), GFP_KERNEL);
> + if (!ras2_ctx)
> + return -ENOMEM;
> +
> + ras2_ctx->sys_comp_nid = pxm_to_node(pxm_inst);
> + /*
> + * Retrieve the lowest contiguous physical memory address range within
> + * the NUMA node.
> + */
> + start_pfn = node_start_pfn(ras2_ctx->sys_comp_nid);
> + size_pfn = node_spanned_pages(ras2_ctx->sys_comp_nid);
> + if (!size_pfn) {
> + pr_debug("Failed to find phy addr range for NUMA node(%u)\n",
> + pxm_inst);
> + goto ctx_free;
> + }
> + ras2_ctx->mem_base_addr = __pfn_to_phys(start_pfn);
> + ras2_ctx->mem_size = __pfn_to_phys(size_pfn);
> +
> + rc = ras2_register_pcc_channel(ras2_ctx, channel);
> + if (rc < 0) {
> + pr_debug("Failed to register pcc channel rc=%d\n", rc);
> + goto ctx_free;
> + }
> +
> + id = ida_alloc(&ras2_ida, GFP_KERNEL);
> + if (id < 0) {
> + rc = id;
> + goto ctx_free;
> + }
> +
> + ras2_ctx->adev.id = id;
> + ras2_ctx->adev.name = RAS2_MEM_DEV_ID_NAME;
> + ras2_ctx->adev.dev.release = ras2_release;
> + ras2_ctx->adev.dev.parent = ras2_ctx->dev;
> +
> + rc = auxiliary_device_init(&ras2_ctx->adev);
> + if (rc)
> + goto ida_free;
> +
> + rc = auxiliary_device_add(&ras2_ctx->adev);
> + if (rc) {
> + auxiliary_device_uninit(&ras2_ctx->adev);
> + return rc;
> + }
> +
> + return 0;
> +
> +ida_free:
> + ida_free(&ras2_ida, id);
> +ctx_free:
> + kfree(ras2_ctx);
> +
> + return rc;
> +}
> +
> +static int acpi_ras2_parse(struct acpi_table_ras2 *ras2_tab)
> +{
> + struct acpi_ras2_pcc_desc *pcc_desc_list;
> + int rc;
> + u16 i;
> +
> + if (ras2_tab->header.length < sizeof(*ras2_tab)) {
> + pr_warn(FW_WARN "ACPI RAS2 table present but broken (too short #1)\n");
> + return -EINVAL;
> + }
> +
> + if (!ras2_tab->num_pcc_descs) {
> + pr_warn(FW_WARN "No PCC descs in ACPI RAS2 table\n");
> + return -EINVAL;
> + }
> +
> + pcc_desc_list = (struct acpi_ras2_pcc_desc *)(ras2_tab + 1);
> + for (i = 0; i < ras2_tab->num_pcc_descs; i++, pcc_desc_list++) {
> + if (pcc_desc_list->feature_type != RAS2_FEAT_TYPE_MEMORY)
> + continue;
> +
> + rc = ras2_add_aux_device(RAS2_MEM_DEV_ID_NAME,
> + pcc_desc_list->channel_id,
> + pcc_desc_list->instance);
> + if (rc)
> + pr_warn("Failed to add RAS2 auxiliary device rc=%d\n", rc);
> + }
> +
> + return 0;
Should this return 'rc' from above? Or is the 'warning' case not a total
failure?
Thanks,
Yazen
next prev parent reply other threads:[~2025-09-09 16:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-02 17:30 [PATCH v12 0/2] ACPI: Add support for ACPI RAS2 feature table shiju.jose
2025-09-02 17:30 ` [PATCH v12 1/2] ACPI:RAS2: Add ACPI RAS2 driver shiju.jose
2025-09-09 16:24 ` Yazen Ghannam [this message]
2025-09-10 8:38 ` Shiju Jose
2025-09-10 19:27 ` Borislav Petkov
2025-09-12 12:04 ` Shiju Jose
2025-09-12 14:11 ` Borislav Petkov
2025-09-15 11:50 ` Shiju Jose
2025-09-17 16:22 ` Borislav Petkov
2025-09-17 17:36 ` Jonathan Cameron
2025-09-18 20:22 ` Daniel Ferguson
2025-09-19 10:39 ` Borislav Petkov
2025-10-06 10:37 ` Shiju Jose
2025-10-16 10:30 ` Borislav Petkov
2025-10-17 12:54 ` Shiju Jose
2025-10-24 18:13 ` Daniel Ferguson
2025-11-03 13:19 ` Borislav Petkov
2025-11-04 12:55 ` Shiju Jose
2025-11-22 11:36 ` Borislav Petkov
2025-09-02 17:30 ` [PATCH v12 2/2] ras: mem: Add memory " shiju.jose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250909162434.GB11602@yaz-khff2.amd.com \
--to=yazen.ghannam@amd.com \
--cc=Jon.Grimm@amd.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dferguson@amperecomputing.com \
--cc=duenwen@google.com \
--cc=erdemaktas@google.com \
--cc=gthelen@google.com \
--cc=james.morse@arm.com \
--cc=jiaqiyan@google.com \
--cc=jonathan.cameron@huawei.com \
--cc=jthoughton@google.com \
--cc=kangkang.shen@futurewei.com \
--cc=lenb@kernel.org \
--cc=leo.duran@amd.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxarm@huawei.com \
--cc=mchehab@kernel.org \
--cc=naoya.horiguchi@nec.com \
--cc=nifan.cxl@gmail.com \
--cc=pgonda@google.com \
--cc=prime.zeng@hisilicon.com \
--cc=rafael@kernel.org \
--cc=rientjes@google.com \
--cc=roberto.sassu@huawei.com \
--cc=rppt@kernel.org \
--cc=shiju.jose@huawei.com \
--cc=somasundaram.a@hpe.com \
--cc=tanxiaofei@huawei.com \
--cc=tony.luck@intel.com \
--cc=wanghuiqiang@huawei.com \
--cc=wbs@os.amperecomputing.com \
--cc=wschwartz@amperecomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox