public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/3] staging: keucr: Use memcmp() instead custom
Date: Sun, 02 Jan 2011 21:10:56 +0000	[thread overview]
Message-ID: <1294002656.23422.7.camel@Joe-Laptop> (raw)
In-Reply-To: <1294002097-3058-2-git-send-email-martinez.javier@gmail.com>

On Sun, 2011-01-02 at 22:01 +0100, Javier Martinez Canillas wrote:
> Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
> diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c
> @@ -1482,54 +1482,55 @@ BYTE _Check_D_DevCode(BYTE dcode)
>  //----- Check_D_ReadError() ----------------------------------------------
>  int Check_D_ReadError(BYTE *redundant)
>  {
> -    // Driver 䣰 ECC Check
> -    return(SUCCESS);
> -    if (!StringCmp((char *)(redundant+0x0D),(char *)EccBuf,3))
> -        if (!StringCmp((char *)(redundant+0x08),(char *)(EccBuf+0x03),3))
> -            return(SUCCESS);
> +	/* Driver ECC Check */
> +	if (memcmp(redundant + 0x0D, EccBuf, 3) ||
> +	    memcmp(redundant + 0x08, EccBuf + 0x03, 3))
> +		return ERROR;
>  
> -    return(ERROR);
> +	return SUCCESS;
>  }

This code isn't the same.

Before, the return was always SUCCESS and the code
after the first return was ignored.

You deleted that return and now you do the driver ECC check.
Is that correct?
 
>  //----- Check_D_Correct() ----------------------------------------------
>  int Check_D_Correct(BYTE *buf,BYTE *redundant)
>  {
> -    // Driver 䣰 ECC Check
> -    return(SUCCESS);
> -    if (StringCmp((char *)(redundant+0x0D),(char *)EccBuf,3))
> -        if (_Correct_D_SwECC(buf,redundant+0x0D,EccBuf))
> -            return(ERROR);
> +	/* Driver ECC Check */
> +	if (memcmp(redundant + 0x0D, EccBuf, 3) &&
> +	    _Correct_D_SwECC(buf, redundant + 0x0D, EccBuf))
> +		return ERROR

Here too.



  reply	other threads:[~2011-01-02 21:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-02 21:01 [PATCH 1/3] staging: keucr: Use memcmp() instead custom StringCmp() and some style cleanups Javier Martinez Canillas
2011-01-02 21:10 ` Joe Perches [this message]
2011-01-02 21:21 ` [PATCH 1/3] staging: keucr: Use memcmp() instead custom Javier Martinez Canillas
2011-01-02 21:25 ` Joe Perches

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=1294002656.23422.7.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=kernel-janitors@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox