Re: alloc/free quesion in ixp4xx driver

Phil Endecott
2007-05-17T18:07:45Z

MikeW wrote:
> Phil Endecott <spam_from_linux_mtd <at> chezphil.org> writes:
>> - In ixp4xx_flash_probe(), a struct ixp4xx_flash_info in kalloc()ed.
>> Where is it freed?
>>
>> - In ixp4xx_flash_remove() you have:
>> release_resource(info->res);
>> kfree(info->res);
>> In other places where release_resource() is called I do not see a
>> call to kfree(). Is this right?

> Don't think it should kfree(info->res), the release_resource() sorts
> out the allocated mem region.
>
> But there should be a kfree(info) somewhere in the driver.
>
> My guess is that you have spotted a typo, and there should be a
> kfree(info) next, just outside the if (info->res) block.

Similar issues occur in integrator-flash.c, ixp2000.c, physmap.c and physmap_of.c.

I don't have hardware where mtd can be modular; like probably 99% of
applications it's the root filesystem so it's hard to unload it. But
not being able to test it hasn't stopped me from writing a patch, which
will follow shortly. I hope that there's someone out there who can
test it!

Phil.