Re: [PATCH] media: pci: hws: only init channels the device actually has

Ben Hoff <[email protected]>
Newsgroups org.kernel.vger.linux-media,org.kernel.vger.linux-kernel
Message-ID <CAMSzxxTQDRYQfL4XaGiNuyCcER2Vamo6zqij8JXsBVN69kSWjg@mail.gmail.com>
Reviewed-by: Ben Hoff <[email protected]>

On Wed, Aug 19, 2026 at 2:34 AM Linkai Gong <[email protected]> wrote:
>
> hws_probe() initializes max_channels (always 4) control handlers, but
> register/unregister only walk cur_max_video_ch (1 or 2 on smaller
> chips). The extra handlers are never freed.
>
> Initialize the same number of channels that cleanup uses.
>
> Fixes: ba07fd2f5742 ("media: pci: add AVMatrix HWS capture driver")
> Signed-off-by: Linkai Gong <[email protected]>
> ---
>  drivers/media/pci/hws/hws_pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/drivers/media/pci/hws/hws_pci.c b/drivers/media/pci/hws/hws_pci.c
> index 30bb7d34465b..87ba27877f29 100644
> --- a/drivers/media/pci/hws/hws_pci.c
> +++ b/drivers/media/pci/hws/hws_pci.c
> @@ -441,7 +441,7 @@ static int hws_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
>         hws_init_video_sys(hws, false);
>
>         /* 5) Init channels (video state, locks, vb2, ctrls) */
> -       for (i = 0; i < hws->max_channels; i++) {
> +       for (i = 0; i < hws->cur_max_video_ch; i++) {
>                 ret = hws_video_init_channel(hws, i);
>                 if (ret) {
>                         dev_err(&pdev->dev, "video channel init failed (ch=%d)\n", i);
> --
> 2.25.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.