> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Premi, Sanjeev
> Sent: Friday, October 22, 2010 2:43 PM
> To: [email protected]
> Subject: hwmod and insertable modules
> 
> Hi all,
> 
> I was trying to use hwmod in one of the modules that user could choose
> to insert via insmod.
> 
> During module_init I used omap_device_build() to create the 
> omap_device.
> But when trying to implement the module_exit, I couldn't find the
> corresponding 'destructor'.
> 
> I do see 4 kzalloc()s being called for each omap_device_build(). I do
> have a half-implemented destructor; but before I proceeded ahead I
> wanted to pose few questions which can help undertand if I am on a
> good track:
> 
> 1) Is the omap_device supposed to be persistent? i.e. subsequent
>    calls will return me the same device object?
> 
> 2) Has someone else tried to to use omap_device and done multiple
>    insmod and rmmod operations?
> 
> 3) Is my fear of memory leak real? OR there is some magic behind
>    omap_device_shutdown() that I haven't yet discovered? 
> 
> Best regards,
> Sanjeev

Forgot to add the destructor I had implemented - not yet tested.

void omap_device_destroy(struct omap_device *od)
{
        if (!od)
                return ERR_PTR(-EINVAL);

        kfree(od->pdev.name);
        kfree(od->pdev.resource);
        kfree(od->hwmods);
        kfree(od);
}

--
> To unsubscribe from this list: send the line "unsubscribe 
> linux-omap" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to