Thread (3 messages) flat view 3 messages, 2 authors, 2006-08-22

Re: [2.6.19 PATCH 3/7] ehea: queue management

From: Jan-Bernd Themann <hidden>
Date: 2006-08-22 14:31:17
Also in: lkml, netdev

Hi,

On Tuesday 22 August 2006 16:01, Arnd Bergmann wrote:
quoted
+=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);
quoted
+=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);
quoted
+=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");
quoted
+=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;
quoted
+=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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help