Thread (24 messages) flat view 24 messages, 7 authors, 2016-01-18

Re: gianfar: Less function calls in gfar_ethflow_to_filer_table() after error detection

From: Joe Perches <joe@perches.com>
Date: 2016-01-15 12:03:56
Also in: kernel-janitors, lkml

On Fri, 2016-01-15 at 12:47 +0100, SF Markus Elfring wrote:
quoted
quoted
* Return directly if a memory allocation failed at the beginning.

* Adjust jump targets according to the Linux coding style
convention.

This issue was detected by using the Coccinelle software.
Is this really better?

Perhaps this particular static analysis isn't too useful.
The opinions are still evolving for such a kind of search pattern.

quoted
Why not just allocate once and assign a second pointer?

	local_rqfpr = kmalloc_array(2 * (MAX_FILER_IDX + 1),
				    sizeof(unsigned int), GFP_KERNEL);
	if (!local_rqfpr)
		goto err;

	local_rqfcr = &local_rqfpr[MAX_FILER_IDX + 1];
Do you suggest to use only one array (instead of two as before) here?
That's a possibility.

If, as your title suggests, you really want fewer function
calls, (which as far as I saw, you didn't do) that could
be a mechanism to remove both an allocation and a free.

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help