All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chee, Tien Fong <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] common: Generic firmware loader for file system
Date: Tue, 12 Dec 2017 04:51:44 +0000	[thread overview]
Message-ID: <1513054302.2900.3.camel@intel.com> (raw)
In-Reply-To: <20171211131656.5466c9e5@karo-electronics.de>

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 at 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

      reply	other threads:[~2017-12-12  4:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 10:53 [U-Boot] [PATCH 0/2] Generic firmware loader tien.fong.chee at intel.com
2017-12-11 10:53 ` [U-Boot] [PATCH 1/2] arm: socfpga: Remove static declaration on spl_mmc_find_device function tien.fong.chee at intel.com
2017-12-11 11:03   ` Marek Vasut
2017-12-12  4:49     ` Chee, Tien Fong
2017-12-11 10:53 ` [U-Boot] [PATCH 2/2] common: Generic firmware loader for file system tien.fong.chee at intel.com
2017-12-11 12:16   ` Lothar Waßmann
2017-12-12  4:51     ` Chee, Tien Fong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513054302.2900.3.camel@intel.com \
    --to=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.