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]
Date:	Tue, 10 May 2011 17:15:14 -0700
From:	Joe Perches <joe@...ches.com>
To:	Linus Walleij <linus.walleij@...aro.org>
Cc:	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Martin Persson <martin.persson@...ricsson.com>,
	Lee Jones <lee.jones@...aro.org>,
	Stephen Warren <swarren@...dia.com>,
	Russell King <linux@....linux.org.uk>
Subject: Re: [PATCH] drivers: create a pinmux subsystem v2

On Wed, 2011-05-11 at 01:39 +0200, Linus Walleij wrote:
> This creates a subsystem for handling of pinmux devices.
[]
> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
[]

Nice work and yes, more trivia...

> diff --git a/drivers/pinmux/core.c b/drivers/pinmux/core.c
[]
> +struct pin_desc {
> +	struct pinmux_dev *pmxdev;
> +	bool	requested;
> +	char	function[16];

Magic number 16 used here and a couple other places.

I also think function is a poor variable name for a descriptor.
Might ever this need the size increased or the use changed
to const char* func_desc (with kstrdup or equivalent)

> +	if (status) {
> +		pr_err("->request on device %s failed "
> +		       "for pin %d (offset %d)\n",

I think prefacing with "->" doesn't add anything and
I think it's better to ignore 80 column line lengths for
formats.  Maybe:

		pr_err("device %s: request for pin %d/offset %d failed\n",

> +	strncpy(desc->function, function, 16);
> +	desc->function[15] = '\0';

Here's that magic number again.  Maybe:
	strlcpy(desc->function, function, sizeof(desc->function));
or maybe:
	kstrdup(desc->func_name, function, GFP_KERNEL);

> +
> +out:
> +	spin_unlock_irqrestore(&pin_desc_lock, flags);
> +	if (status)
> +		pr_err("pin-%d (%s) status %d\n",
> +		       pin, function ? : "?", status);

Why test function for non-null only here?

> +int pinmux_register_mappings(struct pinmux_map const *maps, unsigned num_maps)

const struct pinmux_map *maps?
Normal kernel style uses const before struct.

> +void pinmux_put(struct pinmux *pmx)
[]
> +		pr_warn("pinmux: releasing pinmux with active users!\n");

I think you don't need the prefix anymore.

cheers, Joe

--
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