lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201111301330.09043.arnd.bergmann@linaro.org>
Date:	Wed, 30 Nov 2011 13:30:08 +0000
From:	Arnd Bergmann <arnd.bergmann@...aro.org>
To:	Linus Walleij <linus.walleij@...ricsson.com>
Cc:	linux-kernel@...r.kernel.org, Stephen Warren <swarren@...dia.com>,
	Grant Likely <grant.likely@...retlab.ca>,
	Barry Song <21cnbao@...il.com>,
	Shawn Guo <shawn.guo@...escale.com>,
	Thomas Abraham <thomas.abraham@...aro.org>,
	Dong Aisheng <dong.aisheng@...aro.org>,
	Rajendra Nayak <rajendra.nayak@...aro.org>,
	Haojian Zhuang <haojian.zhuang@...vell.com>,
	Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH 1/2 v3] pinctrl: make a copy of pinmux map

On Wednesday 30 November 2011, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@...aro.org>
> 
> This makes a deep copy of the pinmux function map instead of
> keeping the copy supplied from the platform around. This makes
> it possible to tag the platforms map with __initdata as is also
> done as part of this patch.
> 
> Rationale: a certain target platform (PXA) has numerous
> pinmux maps, many of which will be lying around unused after
> boot in a multi-platform binary. Instead, deep-copy the one
> we're going to use and tag them all __initdata so they go away
> after boot.
> 
> Suggested-by: Arnd Bergmann <arnd.bergmann@...aro.org>
> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>

Reviewed-by: Arnd Bergmann <arnd@...aro.org>

> @@ -348,32 +351,48 @@ EXPORT_SYMBOL_GPL(pinmux_gpio_direction_output);
>  int __init pinmux_register_mappings(struct pinmux_map const *maps,
>  				    unsigned num_maps)
>  {
> +	int ret = 0;
>  	int i;
>  
> -	if (pinmux_maps != NULL) {
> +	if (pinmux_maps_num != 0) {
>  		pr_err("pinmux mappings already registered, you can only "
>  		       "register one set of maps\n");
>  		return -EINVAL;
>  	}

A trick pointed out by Rusty Russell in a recent blog post [1] is to
not initialize the return value initially, but always set it only
in the error path so that the compiler can warn you when you ever
forget setting it in one path.

	Arnd

[1] http://rusty.ozlabs.org/?p=232
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ