Messages in this thread | | | Date | Wed, 25 Jul 2012 00:55:27 -0700 | From | Stephen Boyd <> | Subject | Re: [RFC PATCH 06/13] driver core: firmware loader: always let firmware_buf own the pages buffer |
| |
Mostly trivia.
On 7/24/2012 10:00 AM, Ming Lei wrote: > + > +static int fw_lookup_and_alloate_buf(const char *fw_name,
allocate?
> + struct firmware_cache *fwc, > + struct firmware_buf **buf) > +{ > + struct firmware_buf *tmp; > + > + spin_lock(&fwc->lock); > + list_for_each_entry(tmp, &fwc->head, list) > + if (!strcmp(tmp->fw_id, fw_name)) { > + kref_get(&tmp->ref); > + spin_unlock(&fwc->lock); > + *buf = tmp; > + return 1; > + } > + > + tmp = __allocate_fw_buf(fw_name, fwc); > + if (tmp) > + list_add(&tmp->list, &fwc->head); > + spin_unlock(&fwc->lock); > + > + *buf = tmp; > + > + return tmp ? 0 : -1;
-ENOMEM instead of -1?
> + > +static void fw_cache_init(void)
__init?
> +{ > + spin_lock_init(&fw_cache.lock); > + INIT_LIST_HEAD(&fw_cache.head); > +} > + [...] > uevent, nowait); > > -/* transfer the ownership of pages to firmware */ > -static void fw_set_page_data(struct firmware_buf *buf) > -{ > - struct firmware *fw = buf->fw; > + if (IS_ERR(fw_priv) || ret == -1) { > + kfree(firmware); > + *firmware_p = NULL; > + return ERR_PTR(-ENOMEM);
This would have to check for < 0 and return ERR_PTR(ret) instead.
-- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
| |