From: James Bottomley <James.Bottomley@suse.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] drivers: scsi: remove private hex_to_bin() implementation
Date: Sat, 11 Sep 2010 08:56:35 -0500 [thread overview]
Message-ID: <1284213395.2986.9.camel@mulgrave.site> (raw)
In-Reply-To: <1284212280-25944-1-git-send-email-andy.shevchenko@gmail.com>
On Sat, 2010-09-11 at 16:38 +0300, Andy Shevchenko wrote:
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
> Cc: linux-scsi@vger.kernel.org
> ---
> drivers/scsi/libsas/sas_scsi_host.c | 10 +++-------
> 1 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
> index f0cfba9..527dcf7 100644
> --- a/drivers/scsi/libsas/sas_scsi_host.c
> +++ b/drivers/scsi/libsas/sas_scsi_host.c
> @@ -1078,14 +1078,10 @@ void sas_target_destroy(struct scsi_target *starget)
> static void sas_parse_addr(u8 *sas_addr, const char *p)
> {
> int i;
> - for (i = 0; i < SAS_ADDR_SIZE; i++) {
> + for (i = 0; i < SAS_ADDR_SIZE && *p; i++) {
> u8 h, l;
> - if (!*p)
> - break;
> - h = isdigit(*p) ? *p-'0' : toupper(*p)-'A'+10;
> - p++;
> - l = isdigit(*p) ? *p-'0' : toupper(*p)-'A'+10;
> - p++;
> + h = hex_to_bin(*p++);
> + l = hex_to_bin(*p++);
the hex_to_bin() is really to prevent open coded mistakes. When the
open coding pre-dates the hex_to_bin macro, I'm inclined to leave it
alone unless it contains an actual bug.
James
next prev parent reply other threads:[~2010-09-11 13:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-11 13:38 [PATCH] drivers: scsi: remove private hex_to_bin() implementation Andy Shevchenko
2010-09-11 13:56 ` James Bottomley [this message]
2010-09-22 8:41 ` Andy Shevchenko
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=1284213395.2986.9.camel@mulgrave.site \
--to=james.bottomley@suse.de \
--cc=andy.shevchenko@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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.