Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but 
`vga_switchto_stage2()` leaves the switcheroo system permanently disabled if 
the hardware switch handler fails. The active client's state is not restored, 
permanently corrupting the subsystem's state machine.
--

--- Patch [7]: [PATCH v2 7/7] vga-switcheroo: Remove unused interfaces ---
commit ef7b188cece6d285e2c3384cc1c77c0b8424b231
Author: Thomas Zimmermann <[email protected]>

vga-switcheroo: Remove unused interfaces

This commit removes unused interfaces that implemented pre_switch and
post_switch functionality. It specifically removes
vga_switcheroo_client_fb_set() and the reprobe callback from client ops,
cleaning up obsolete code referencing fbdev.

> diff --git a/drivers/gpu/vga/vga_switcheroo.c 
> b/drivers/gpu/vga/vga_switcheroo.c
> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c

[ ... ]

> @@ -735,10 +712,6 @@ static int vga_switchto_stage2(struct 
> vga_switcheroo_client *new_client)
>  
>       if (new_client->ops->pre_switch)
>               new_client->ops->pre_switch(new_client->pdev);
> -#if defined(CONFIG_FB)
> -     else if (new_client->fb_info)
> -             fb_switch_outputs(new_client->fb_info);
> -#endif
>  
>       mutex_lock(&vgasr_priv.mux_hw_lock);
>       ret = vgasr_priv.handler->switchto(new_client->id);
>       mutex_unlock(&vgasr_priv.mux_hw_lock);
>       if (ret)
>               return ret;

[Severity: High]
This is a pre-existing issue, but does this error path leave the switcheroo
system permanently disabled if the hardware switch handler fails?

Earlier in vga_switchto_stage2(), the active client is marked inactive
(active->active = false) and the audio state might be set to OFF. If
vgasr_priv.handler->switchto() fails, the code returns early without restoring
active->active.

Because the active state is not restored, will find_active_client()
subsequently return NULL, causing future switch requests to silently abort
and leaving the subsystem in a corrupted state?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=7

Reply via email to