All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan-Bernd Themann <ossthema@de.ibm.com>
To: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: Thomas Klein <tklein@de.ibm.com>,
	Jan-Bernd Themann <themann@de.ibm.com>,
	netdev <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-ppc <linuxppc-dev@ozlabs.org>,
	Christoph Raisch <raisch@de.ibm.com>,
	Marcus Eder <meder@de.ibm.com>
Subject: Re: [2.6.19 PATCH 3/7] ehea: queue management
Date: Tue, 22 Aug 2006 15:51:07 +0200	[thread overview]
Message-ID: <200608221551.08406.ossthema@de.ibm.com> (raw)
In-Reply-To: <200608221601.24882.arnd.bergmann@de.ibm.com>

Hi,

On Tuesday 22 August 2006 16:01, Arnd Bergmann wrote:
> > +=A0=A0=A0=A0=A0=A0=A0u64 rpage =3D 0;
> > +=A0=A0=A0=A0=A0=A0=A0int ret;
> > +=A0=A0=A0=A0=A0=A0=A0int cnt =3D 0;
> > +=A0=A0=A0=A0=A0=A0=A0void *vpage =3D NULL;
> > +
> > +=A0=A0=A0=A0=A0=A0=A0ret =3D hw_queue_ctor(hw_queue, nr_pages, EHEA_PA=
GESIZE, wqe_size);
> > +=A0=A0=A0=A0=A0=A0=A0if (ret)
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return ret;
> > +
> > +=A0=A0=A0=A0=A0=A0=A0for (cnt =3D 0; cnt < nr_pages; cnt++) {
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0vpage =3D hw_qpageit_get_=
inc(hw_queue);
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0if (!vpage) {
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0e=
hea_error("hw_qpageit_get_inc failed");
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0g=
oto qp_alloc_register_exit0;
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0}
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0rpage =3D virt_to_abs(vpa=
ge);
>=20
> As someone mentioned before, the initialization to 0 or NULL
> is pointless here, as the variables are always assigned before
> they are used. There are a number of other places in your
> code that do similar things, you should probably go through
> these and remove the initializers.
>=20
> If you indeed need something to be initialized, it is good practice
> to do the initialization as late as possible, e.g.
>=20
> 	int foo;
> 	...
> 	foo =3D 0;
> 	do_foo(foo);
>=20
> to make it clear that you have a reason to initialize it.
>=20
> 	Arnd <><
>=20

Agreed. We started to remove some but apparrently not all.
We'll go through the code and remove them where possible.

WARNING: multiple messages have this Message-ID (diff)
From: Jan-Bernd Themann <ossthema@de.ibm.com>
To: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: netdev <netdev@vger.kernel.org>,
	Christoph Raisch <raisch@de.ibm.com>,
	"Jan-Bernd Themann" <themann@de.ibm.com>,
	"linux-kernel" <linux-kernel@vger.kernel.org>,
	"linux-ppc" <linuxppc-dev@ozlabs.org>,
	Marcus Eder <meder@de.ibm.com>, Thomas Klein <tklein@de.ibm.com>
Subject: Re: [2.6.19 PATCH 3/7] ehea: queue management
Date: Tue, 22 Aug 2006 15:51:07 +0200	[thread overview]
Message-ID: <200608221551.08406.ossthema@de.ibm.com> (raw)
In-Reply-To: <200608221601.24882.arnd.bergmann@de.ibm.com>

Hi,

On Tuesday 22 August 2006 16:01, Arnd Bergmann wrote:
> > +       u64 rpage = 0;
> > +       int ret;
> > +       int cnt = 0;
> > +       void *vpage = NULL;
> > +
> > +       ret = hw_queue_ctor(hw_queue, nr_pages, EHEA_PAGESIZE, wqe_size);
> > +       if (ret)
> > +               return ret;
> > +
> > +       for (cnt = 0; cnt < nr_pages; cnt++) {
> > +               vpage = hw_qpageit_get_inc(hw_queue);
> > +               if (!vpage) {
> > +                       ehea_error("hw_qpageit_get_inc failed");
> > +                       goto qp_alloc_register_exit0;
> > +               }
> > +               rpage = virt_to_abs(vpage);
> 
> As someone mentioned before, the initialization to 0 or NULL
> is pointless here, as the variables are always assigned before
> they are used. There are a number of other places in your
> code that do similar things, you should probably go through
> these and remove the initializers.
> 
> If you indeed need something to be initialized, it is good practice
> to do the initialization as late as possible, e.g.
> 
> 	int foo;
> 	...
> 	foo = 0;
> 	do_foo(foo);
> 
> to make it clear that you have a reason to initialize it.
> 
> 	Arnd <><
> 

Agreed. We started to remove some but apparrently not all.
We'll go through the code and remove them where possible.


  reply	other threads:[~2006-08-22 14:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-22 12:53 [2.6.19 PATCH 3/7] ehea: queue management Jan-Bernd Themann
2006-08-22 12:53 ` Jan-Bernd Themann
2006-08-22 14:01 ` Arnd Bergmann
2006-08-22 14:01   ` Arnd Bergmann
2006-08-22 13:51   ` Jan-Bernd Themann [this message]
2006-08-22 13:51     ` Jan-Bernd Themann
  -- strict thread matches above, loose matches on Subject: below --
2006-09-06 13:32 Jan-Bernd Themann
2006-09-06 13:32 ` Jan-Bernd Themann
2006-09-04 10:39 Jan-Bernd Themann
2006-09-04 10:39 ` Jan-Bernd Themann
2006-08-23  8:57 Jan-Bernd Themann
2006-08-23  8:57 ` Jan-Bernd Themann
2006-08-18 11:31 Jan-Bernd Themann
2006-08-18 11:31 ` Jan-Bernd Themann
2006-08-18 12:17 ` Arjan van de Ven
2006-08-18 12:17   ` Arjan van de Ven
2006-08-18 13:25   ` Thomas Klein
2006-08-18 13:25     ` Thomas Klein
2006-08-18 13:47     ` Arnd Bergmann
2006-08-18 13:47       ` Arnd Bergmann
2006-08-18 14:24       ` Christoph Raisch
2006-08-18 14:24         ` Christoph Raisch
2006-08-18 16:16         ` Arnd Bergmann
2006-08-18 16:16           ` Arnd Bergmann
2006-08-18 14:33     ` Jörn Engel
2006-08-18 14:33       ` Jörn Engel
2006-08-18 14:40 ` Jörn Engel
2006-08-18 14:40   ` Jörn Engel

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=200608221551.08406.ossthema@de.ibm.com \
    --to=ossthema@de.ibm.com \
    --cc=arnd.bergmann@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=meder@de.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=raisch@de.ibm.com \
    --cc=themann@de.ibm.com \
    --cc=tklein@de.ibm.com \
    /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.