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: linuxppc-dev, lkml

Hi,

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