Subject: Re: [net-next-2.6 PATCH] net: device name allocation cleanups

From: Stephen Hemminger <[email-masked]>
Date: Tue, 17 Nov 2009 16:46:33 -0800

On Tue, 17 Nov 2009 22:33:53 +0200
Octavian Purdila <[email-masked]> wrote:

> +	if (fmt) {
> +		if (strchr(name, '%'))
> +			return __dev_alloc_name(net, name, buf);
> +	}
> +
> +	if (__dev_get_by_name(net, name))

Flatten this logic out.

        if (fmt && strchr(name, '%'))
		return __dev_alloc_name(net, name, buf);
	else if (__dev_get_by_name(net, name))
		return -EEXIST;
	else if (buf != name) 
		strlcpy(buf, name, IFNAMSIZ);

	return 0;