From: Chaithanya Lagisetty <nagachaithanya9911@gmail.com>
To: Huacai Chen <chenhuacai@kernel.org>,
Bibo Mao <maobibo@loongson.cn>,
Tianrui Zhao <zhaotianrui@loongson.cn>
Cc: WANG Xuerui <kernel@xen0n.name>,
Xianglai Li <lixianglai@loongson.cn>,
kvm@vger.kernel.org, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org,
Chaithanya Lagisetty <nagachaithanya9911@gmail.com>
Subject: [PATCH] LoongArch: KVM: Return the actual error code in kvm_pch_pic_create()
Date: Tue, 29 Sep 2026 05:27:12 +0000 [thread overview]
Message-ID: <20260929052712.470413-1-nagachaithanya9911@gmail.com> (raw)
kvm_pch_pic_create() sets up the default IRQ routing and reports every
failure as -ENOMEM, discarding the error code it was given:
ret = kvm_setup_default_irq_routing(kvm);
if (ret)
return -ENOMEM;
kvm_setup_default_irq_routing() returns -ENOMEM only when its routing
entry array cannot be allocated. Otherwise it forwards the result of
kvm_set_irq_routing(), which also fails with -EINVAL when an entry is
rejected by setup_routing_entry(). Userspace creating a
KVM_DEV_TYPE_LOONGARCH_PCHPIC device can therefore receive -ENOMEM even
when IRQ routing setup actually failed with -EINVAL.
Return ret so the original error code reaches userspace. This matches
kvm_eiointc_create(), which already propagates the error code from the
helpers it calls.
Only compile-tested.
Fixes: 1928254c5ccb ("LoongArch: KVM: Add irqfd support")
Signed-off-by: Chaithanya Lagisetty <nagachaithanya9911@gmail.com>
---
arch/loongarch/kvm/intc/pch_pic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/loongarch/kvm/intc/pch_pic.c b/arch/loongarch/kvm/intc/pch_pic.c
index 2b63b0c2c7ce..7fee60ae01a5 100644
--- a/arch/loongarch/kvm/intc/pch_pic.c
+++ b/arch/loongarch/kvm/intc/pch_pic.c
@@ -444,7 +444,7 @@ static int kvm_pch_pic_create(struct kvm_device *dev, u32 type)
ret = kvm_setup_default_irq_routing(kvm);
if (ret)
- return -ENOMEM;
+ return ret;
s = kzalloc_obj(struct loongarch_pch_pic);
if (!s)
--
2.43.0
next reply other threads:[~2026-09-29 5:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 5:27 Chaithanya Lagisetty [this message]
2026-09-29 9:04 ` Bibo Mao
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=20260929052712.470413-1-nagachaithanya9911@gmail.com \
--to=nagachaithanya9911@gmail.com \
--cc=chenhuacai@kernel.org \
--cc=kernel@xen0n.name \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lixianglai@loongson.cn \
--cc=loongarch@lists.linux.dev \
--cc=maobibo@loongson.cn \
--cc=zhaotianrui@loongson.cn \
/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
all inboxes | Powered by JetHome®