On Nov 7, 2006, at 3:44 PM, Robert Hardy wrote:

> hverkuil: Please consider commiting this patch (or an adaption of it.)

> While debugging I found that fw->size tends to fluctuate between  
> reboots and
> in certain instances up to an extra 700KB of random data was being  
> read and
> writen after some firmware files (especially common in
> IVTV_DECODE_INIT_MPEG_FILENAME's case.)

I shouldn't be surprised by the variety of these "sometimes happen to  
some people" things, but I still am.

> The following code rewrites the ivtv-firmware code so that it has more
> checks and balances and more closely matches recently discussed proper
> firmware_class usage examples provided by a new firmware_class  
> maintainer as
> seen on the kernel mailing list.
>
> The most important modification is the code now no longer blindly  
> writes all
> the data fw->size returns if it makes no sense to!

Maybe I misunderstand, but it seems to write at most the requested  
size, not fw->size.

>               if (fw->size >= size) {
> +                     // If there are at least "size" bytes of valid firmware 
> load  
> only "size" worth.
>                       retval = size;
> +                        IVTV_INFO("loading %s firmware (size=%ld  
> bytes;fw->size=%d bytes)\n", fn, size, fw->size);
> +                        memcpy(dst, src, retval);
>               } else {
> -                     retval = fw->size;
> +                     // Otherwise fail loudly
> +                        IVTV_ERR("reported size of firmware %s is % 
> d. It should be at least %ld, loading aborting!\n", fn, fw->size,  
> size);
> +                     retval = -EINVAL;
>               }
> -             for (i = 0; i < retval; i += 4) {
> -                     writel(*src, dst);
> -                     dst++;
> -                     src++;

I'm pretty sure those writel's were there to fix something.... *checks*

Refer to these:

http://ivtvdriver.org/trac/changeset/3089
http://ivtvdriver.org/trac/changeset/3152

-- 
Tyler Trafford



_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to