[U-Boot] [PATCH 2/2] common: Generic firmware loader for file system
Lothar Waßmann
LW at KARO-electronics.de
Mon Dec 11 12:16:56 UTC 2017
Hi,
On Mon, 11 Dec 2017 18:53:46 +0800 tien.fong.chee at intel.com wrote:
> From: Tien Fong Chee <tien.fong.chee at 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!
> + *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
More information about the U-Boot
mailing list