Loading...

ivtv-users@ivtvdriver.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [ivtv-users] Small coding defect / patch Hans Verkuil Thu May 24 06:00:40 2007

> Looking at the 0.10.3 sources for ivtv-firmware.c,
> I see what looks like a small coding error.
>
> ivtv_firmware_copy() calls load_fw_direct() with an expected
> size.  After the call, it checks the size returned, and
> throws an error if they don't match.
>
> However, it looks to me like load_fw_direct() will never
> return an invalid size, since it always returns the size
> that was sent in, not the size returned by request_firmware.

The code is actually correct: it either returns -ENOMEM if it couldn't
load the firmware or if the size is not the requested size AND not 256 kB.
Otherwise it will return the requested size, even if the size was 256 kB.
The 256 kB check is a hack to allow the older 256 kB firmwares.

But this reminds me that I have to remove this hack from the ivtv version
in the kernel as it is no longer needed there.

Regards,

          Hans

>
> This patch changes the behaviour:
>
> --- ivtv-firmware.c.orig        2007-05-23 16:23:17.000000000 -0600
> +++ ivtv-firmware.c     2007-05-23 16:23:38.000000000 -0600
> @@ -75,7 +75,7 @@
>                 }
>                 release_firmware(fw);
>                 IVTV_INFO("loaded %s firmware (%zd bytes)\n", fn,
> fw->size);
> -               return size;
> +               return fw->size;
>         }
>         IVTV_INFO("unable to open firmware %s (must be %ld bytes)\n", fn,
> size);
>         IVTV_INFO("did you put the firmware in the hotplug firmware
> directory?\n");
>
> I would open a ticket, but please see my previous message regarding trac
> access.
>
> Thanks.
>
>
> _______________________________________________
> ivtv-users mailing list
> [EMAIL PROTECTED]
> http://ivtvdriver.org/mailman/listinfo/ivtv-users
>



_______________________________________________
ivtv-users mailing list
[EMAIL PROTECTED]
http://ivtvdriver.org/mailman/listinfo/ivtv-users