netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Green <andy.green@linaro.org>
To: Joe Perches <joe@perches.com>
Cc: linux-omap@vger.kernel.org, s-jan@ti.com, arnd@arndb.de,
	patches@linaro.org, tony@atomide.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, rostedt@goodmis.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4 2/4] NET ethernet introduce mac_platform helper
Date: Thu, 05 Jul 2012 11:20:31 +0800	[thread overview]
Message-ID: <4FF507FF.3000604@linaro.org> (raw)
In-Reply-To: <1341457963.2058.13.camel@joe2Laptop>

On 05/07/12 11:12, the mail apparently from Joe Perches included:

Thanks for the comments.

>> This introduces a small helper in net/ethernet, which registers a network
>> notifier at core_initcall time, and accepts registrations mapping expected
>> asynchronously-probed network device paths (like, "usb1/1-1/1-1.1/1-1.1:1.0")
>> and the MAC that is needed to be assigned to the device when it appears.
>
> The mac prefix is poor.  I think eth_mac is better.

OK.

>> diff --git a/net/ethernet/mac-platform.c b/net/ethernet/mac-platform.c
> []
>> +static int mac_platform_netdev_event(struct notifier_block *this,
>> +						unsigned long event, void *ptr)
>
> alignment to parenthesis please.

OK.  Although different places in the kernel seem to have different 
expectations about that.

>> +int mac_platform_register_device_macs(const struct mac_platform *macs)
>> +{
> []
>> +		next = kmalloc(sizeof(struct mac_platform), GFP_KERNEL);
>> +		if (!next) {
>> +			ret = -ENOMEM;
>> +			goto bail;
>> +		}
>> +
>> +		next->device_path = kmalloc(strlen(macs->device_path) + 1,
>> +								   GFP_KERNEL);
>> +		if (!next->device_path) {
>> +			ret = -ENOMEM;
>> +			goto bail;
>> +		}
>> +
>> +		strcpy(next->device_path, macs->device_path);
>> +		memcpy(next->mac, macs->mac, sizeof macs->mac);
>
> kmemdup and kstrdup()

OK

>> +		list_add(&next->list, &mac_platform_list);
>> +
>> +		macs++;
>> +	}
>> +
>> +bail:
>> +	mutex_unlock(&mac_platform_mutex);
>> +
>> +	return ret;
>> +}
>
> leaking memory on failures.

Right... I'll fix these and wait for more comments.

Thanks again for the review.

-Andy

-- 
Andy Green | TI Landing Team Leader
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106  - 
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog

  reply	other threads:[~2012-07-05  3:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05  2:44 [PATCH 4 0/4] Add ability to set defaultless network device MAC addresses to deterministic computed locally administered values Andy Green
2012-07-05  2:44 ` [PATCH 4 1/4] OMAP: add cpu id register to MAC address helper Andy Green
2012-07-05  2:44 ` [PATCH 4 2/4] NET ethernet introduce mac_platform helper Andy Green
2012-07-05  3:12   ` Joe Perches
2012-07-05  3:20     ` Andy Green [this message]
2012-07-05  3:25       ` Joe Perches
2012-07-06 22:40   ` Ben Hutchings
2012-07-05  2:44 ` [PATCH 4 3/4] OMAP4 PANDA register ethernet and wlan for automatic mac allocation Andy Green
2012-07-05  2:45 ` [PATCH 4 4/4] config test config extending omap2plus with wl12xx etc Andy Green
2012-07-10 12:37 ` [PATCH 4 0/4] Add ability to set defaultless network device MAC addresses to deterministic computed locally administered values Florian Fainelli
2012-07-10 12:58   ` "Andy Green (林安廸)"
2012-07-10 13:08     ` Steven Rostedt
2012-07-10 15:20     ` Alan Cox

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=4FF507FF.3000604@linaro.org \
    --to=andy.green@linaro.org \
    --cc=arnd@arndb.de \
    --cc=joe@perches.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=rostedt@goodmis.org \
    --cc=s-jan@ti.com \
    --cc=tony@atomide.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).