All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V4 1/2] GPIO: Tegra2: add GPIO driver for Tegra2
Date: Thu, 16 Jun 2011 20:06:20 -0400	[thread overview]
Message-ID: <201106162006.22031.vapier@gentoo.org> (raw)
In-Reply-To: <1308268294-14901-2-git-send-email-twarren@nvidia.com>

On Thursday, June 16, 2011 19:51:33 Tom Warren wrote:
> +int gpio_request(int gp, const char *label)
> +{
> +	if (gp >= MAX_NUM_GPIOS)
> +		return -1;
> +
> +	strncpy(gpio_names[gp].name, label, GPIO_NAME_SIZE);

if the label is >=GPIO_NAME_SIZE, the result will not be NUL terminated.  i'd 
suggest you add something like this to after the strncpy call:
	gpio_names[gp].name[GPIO_NAME_SIZE - 1] = '\0';

> +	return (val >> GPIO_BIT(gp)) & 1;

could be written as !!(val >> GPIO_BIT(gp)), but up to you, or see how the 
code size works out

otherwise, looks fine.  not that i looked too closely as i dont know anything 
about Tegra2 parts.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110616/8fd28e78/attachment.pgp 

  reply	other threads:[~2011-06-17  0:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 23:51 [U-Boot] [PATCH V4 0/2] GPIO: Tegra2: add GPIO driver for Tegra2 Tom Warren
2011-06-16 23:51 ` [U-Boot] [PATCH V4 1/2] " Tom Warren
2011-06-17  0:06   ` Mike Frysinger [this message]
2011-06-17  0:09     ` Tom Warren
2011-06-16 23:51 ` [U-Boot] [PATCH V4 2/2] arm: Tegra2: GPIO: enable GPIO for Tegra2 boards Tom Warren

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=201106162006.22031.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.