Re: [RFC PATCH 06/13] driver core: firmware loader: always letfirmware_buf own the pages buffer

From: Ming Lei
Date: Fri Aug 03 2012 - 04:34:46 EST


On Wed, Jul 25, 2012 at 10:37 PM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Wed, Jul 25, 2012 at 01:00:06AM +0800, Ming Lei wrote:

>> @@ -213,13 +291,8 @@ static ssize_t firmware_loading_show(struct device *dev,
>> /* firmware holds the ownership of pages */
>> static void firmware_free_data(const struct firmware *fw)
>> {
>> - int i;
>> - vunmap(fw->data);
>> - if (fw->pages) {
>> - for (i = 0; i < PFN_UP(fw->size); i++)
>> - __free_page(fw->pages[i]);
>> - kfree(fw->pages);
>> - }
>> + WARN_ON(!fw->priv);
>> + fw_free_buf(fw->priv);
>
> Why the WARN_ON?

Because the 'struct firmware' instance is exposed to drivers, it is
better to warn if some drivers clear it during request&release.

Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/