
12 Dec
2017
12 Dec
'17
5:51 a.m.
On Isn, 2017-12-11 at 13:16 +0100, Lothar Waßmann wrote:
Hi,
On Mon, 11 Dec 2017 18:53:46 +0800 tien.fong.chee@intel.com wrote:
From: Tien Fong Chee tien.fong.chee@intel.com
[...}
+/*
- Prepare firmware struct;
- return -ve if fail.
- */
+static int _request_firmware_prepare(struct firmware **firmware_p,
const char *name, void *dbuf,
size_t size, u32 offset)
+{
- struct firmware *firmware = NULL;
- int ret = 0;
- *firmware_p = NULL;
Sigh. This is useless...
- if (!name || name[0] == '\0')
ret = -EINVAL;
unless you do a 'return -EINVAL' here!
You are right, i missed to change this to return. I would fix it.
- *firmware_p = firmware = calloc(1, sizeof(*firmware));
- if (!firmware) {
printf("%s: calloc(struct firmware) failed\n",
__func__);
return -ENOMEM;
- }
- firmware->name = name;
- firmware->data = dbuf;
- firmware->size = size;
- firmware->offset = offset;
- return ret;
+}
Lothar Waßmann