All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shinya Kuribayashi <shinya.kuribayashi@necel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] PCI_READ_VIA_DWORD_OP: initialize val parameter on fail
Date: Wed, 06 Jun 2007 09:51:49 +0900	[thread overview]
Message-ID: <46660525.3000708@necel.com> (raw)
In-Reply-To: <20070605160404.AA899353A97@atlas.denx.de>

Wolfgang Denk wrote:
> In message <4665122B.6010707@necel.com> you wrote:
>> pci_hose_read_config_{byte,word}_via_dword uses a temporary read
>> buffer `val32', so if read_config_dword returns -1 then val32 also
>> should be initialized.
> 
> This is actually misleading, since you  don't  initialize  the  local
> variable  "val32"  (which would not ake sense as it goes out of scope
> anyway when you return from  the  function).  Instead,  you  use  the
> variable  (more exatly, the pointer), the name of which was passed as
> a macro argument.

Ah, my bad. What should be initialized is _val_, not val32.

> I know that this is not your invention, and you  just  copy  existing
> code,  but  I  think  injecting  C statements like this through macro
> arguments is bad style and should be avoided. 
> 
> I have to admit that I don't get wht you need all this "error_code"
> trickery instead of simpley writing
> 
> 	*val = -1;
> 
> 
> Can you please change your patch like that, and while you are at it
> please fix the other uses of this ugly construct as well?

Agreed completely. I'll send patches incorporating your comments, and
with Signed-off-by.

Thanks for your review.
Shinya

  reply	other threads:[~2007-06-06  0:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-05  7:35 [U-Boot-Users] [PATCH] PCI_READ_VIA_DWORD_OP: initialize val parameter on fail Shinya Kuribayashi
2007-06-05 16:04 ` Wolfgang Denk
2007-06-06  0:51   ` Shinya Kuribayashi [this message]
2007-06-06  2:18     ` Shinya Kuribayashi
2007-06-06  3:33     ` Shinya Kuribayashi

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=46660525.3000708@necel.com \
    --to=shinya.kuribayashi@necel.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.