From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Simon Richter <Simon.Richter@hogyros.de>
Cc: linux-pci@vger.kernel.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 2/5] vgaarb: pass errors from pci_set_vga_state() up
Date: Tue, 10 Mar 2026 13:37:10 +0200 [thread overview]
Message-ID: <abACZiX80vhQP0d-@intel.com> (raw)
In-Reply-To: <20260307173538.763188-3-Simon.Richter@hogyros.de>
On Sun, Mar 08, 2026 at 02:35:35AM +0900, Simon Richter wrote:
> pci_set_vga_state() returns an error code, which so far has been ignored by
> the only caller, __vga_tryget(), so forward it to the caller. As the return
> type of __vga_tryget() is a pointer, wrap the error in ERR_PTR().
>
> Signed-off-by: Simon Richter <Simon.Richter@hogyros.de>
> ---
> drivers/pci/vgaarb.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
> index 22b2b6ebdefd..c360eee11dd9 100644
> --- a/drivers/pci/vgaarb.c
> +++ b/drivers/pci/vgaarb.c
> @@ -215,6 +215,7 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev,
> struct vga_device *conflict;
> unsigned int pci_bits;
> u32 flags = 0;
> + int err;
>
> /*
> * Account for "normal" resources to lock. If we decode the legacy,
> @@ -307,7 +308,9 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev,
> if (change_bridge)
> flags |= PCI_VGA_STATE_CHANGE_BRIDGE;
>
> - pci_set_vga_state(conflict->pdev, false, pci_bits, flags);
> + err = pci_set_vga_state(conflict->pdev, false, pci_bits, flags);
> + if (err)
> + return ERR_PTR(err);
I was thinking this one should never fail and maybe could warrant
a WARN, but uv_set_vga_state() involves some kind of BIOS call and
who knows what that does. So maybe a WARN isn't a good idea.
> conflict->owns &= ~match;
>
> /* If we disabled normal decoding, reflect it in owns */
> @@ -337,7 +340,9 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev,
> if (wants & VGA_RSRC_LEGACY_MASK)
> flags |= PCI_VGA_STATE_CHANGE_BRIDGE;
>
> - pci_set_vga_state(vgadev->pdev, true, pci_bits, flags);
> + err = pci_set_vga_state(vgadev->pdev, true, pci_bits, flags);
> + if (err)
> + return ERR_PTR(err);
>
> vgadev->owns |= wants;
> lock_them:
> @@ -455,6 +460,10 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible)
> }
> conflict = __vga_tryget(vgadev, rsrc);
> spin_unlock_irqrestore(&vga_lock, flags);
> + if (IS_ERR(conflict)) {
> + rc = PTR_ERR(conflict);
> + break;
> + }
> if (conflict == NULL)
> break;
>
> --
> 2.47.3
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-03-10 11:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-07 17:35 [PATCH v3 0/5] Bridges without VGA support Simon Richter
2026-03-07 17:35 ` [PATCH v3 1/5] vgaarb: pass vga_get_uninterruptible() errors to userspace Simon Richter
2026-03-24 19:37 ` Bjorn Helgaas
2026-03-25 6:52 ` Simon Richter
2026-03-25 18:29 ` Bjorn Helgaas
2026-03-07 17:35 ` [PATCH v3 2/5] vgaarb: pass errors from pci_set_vga_state() up Simon Richter
2026-03-10 11:37 ` Ville Syrjälä [this message]
2026-03-07 17:35 ` [PATCH v3 3/5] vgaarb: mark vga_get() and wrappers as __must_check Simon Richter
2026-03-10 20:07 ` Bjorn Helgaas
2026-03-11 22:51 ` Simon Richter
2026-03-11 23:14 ` Bjorn Helgaas
2026-03-11 23:29 ` Simon Richter
2026-03-07 17:35 ` [PATCH v3 4/5] pci: check if VGA decoding was really activated Simon Richter
2026-03-10 11:37 ` Ville Syrjälä
2026-03-10 14:08 ` Simon Richter
2026-03-10 15:19 ` Ville Syrjälä
2026-03-10 20:22 ` Bjorn Helgaas
2026-03-11 7:07 ` Simon Richter
2026-03-07 17:35 ` [PATCH v3 5/5] pci: mark pci_set_vga_state() as __must_check Simon Richter
2026-03-10 19:36 ` Bjorn Helgaas
2026-03-11 23:23 ` Simon Richter
2026-03-24 19:34 ` [PATCH v3 0/5] Bridges without VGA support Bjorn Helgaas
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=abACZiX80vhQP0d-@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=Simon.Richter@hogyros.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-pci@vger.kernel.org \
/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