Hi,
On Mon, 11 Dec 2017 18:53:46 +0800 [email protected] wrote:
> From: Tien Fong Chee <[email protected]>
>
[...}
> +/*
> + * 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
_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot