All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Frank Arnold <frank.arnold@amd.com>,
	Borislav Petkov <borislav.petkov@amd.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] cpu: remove some dead code in store_cache_disable()
Date: Thu, 19 Apr 2012 08:30:02 +0000	[thread overview]
Message-ID: <4F8FCA3A.5060504@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120419070053.GB16645@elgon.mountain>

On 04/19/2012 12:30 PM, Dan Carpenter wrote:

> amd_set_l3_disable_slot() never returns -EEXIST, it only returns -EINVAL
> or zero.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
> index 73d08ed..7b4e294 100644
> --- a/arch/x86/kernel/cpu/intel_cacheinfo.c
> +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
> @@ -466,12 +466,9 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
>  		return -EINVAL;
> 
>  	err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val);
> -	if (err) {
> -		if (err = -EEXIST)
> -			printk(KERN_WARNING "L3 disable slot %d in use!\n",
> -					    slot);
> +	if (err)
>  		return err;
> -	}
> +
>  	return count;
>  }
> 


Looking at the comments around the code and the print statement your patch
is trying to remove, I wonder if it would be more appropriate to return
-EEXIST in amd_set_l3_disable_slot(), like this:

---
From: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Subject: [PATCH] cpu: Fix error return code in amd_set_l3_disable_slot()

If the L3 disable slot is already in use, return -EEXIST instead of -EINVAL.
The caller, store_cache_disable(), checks this return value to print an
appropriate warning.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 arch/x86/kernel/cpu/intel_cacheinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 73d08ed..0b49e29 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -433,7 +433,7 @@ int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot,
 	/*  check if @slot is already used or the index is already disabled */
 	ret = amd_get_l3_disable_slot(nb, slot);
 	if (ret >= 0)
-		return -EINVAL;
+		return -EEXIST;
 
 	if (index > nb->l3_cache.indices)
 		return -EINVAL;


Regards,
Srivatsa S. Bhat


WARNING: multiple messages have this Message-ID (diff)
From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Frank Arnold <frank.arnold@amd.com>,
	Borislav Petkov <borislav.petkov@amd.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] cpu: remove some dead code in store_cache_disable()
Date: Thu, 19 Apr 2012 13:48:02 +0530	[thread overview]
Message-ID: <4F8FCA3A.5060504@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120419070053.GB16645@elgon.mountain>

On 04/19/2012 12:30 PM, Dan Carpenter wrote:

> amd_set_l3_disable_slot() never returns -EEXIST, it only returns -EINVAL
> or zero.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
> index 73d08ed..7b4e294 100644
> --- a/arch/x86/kernel/cpu/intel_cacheinfo.c
> +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
> @@ -466,12 +466,9 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
>  		return -EINVAL;
> 
>  	err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val);
> -	if (err) {
> -		if (err == -EEXIST)
> -			printk(KERN_WARNING "L3 disable slot %d in use!\n",
> -					    slot);
> +	if (err)
>  		return err;
> -	}
> +
>  	return count;
>  }
> 


Looking at the comments around the code and the print statement your patch
is trying to remove, I wonder if it would be more appropriate to return
-EEXIST in amd_set_l3_disable_slot(), like this:

---
From: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Subject: [PATCH] cpu: Fix error return code in amd_set_l3_disable_slot()

If the L3 disable slot is already in use, return -EEXIST instead of -EINVAL.
The caller, store_cache_disable(), checks this return value to print an
appropriate warning.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 arch/x86/kernel/cpu/intel_cacheinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 73d08ed..0b49e29 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -433,7 +433,7 @@ int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot,
 	/*  check if @slot is already used or the index is already disabled */
 	ret = amd_get_l3_disable_slot(nb, slot);
 	if (ret >= 0)
-		return -EINVAL;
+		return -EEXIST;
 
 	if (index > nb->l3_cache.indices)
 		return -EINVAL;


Regards,
Srivatsa S. Bhat


  reply	other threads:[~2012-04-19  8:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-19  7:00 [patch] cpu: remove some dead code in store_cache_disable() Dan Carpenter
2012-04-19  7:00 ` Dan Carpenter
2012-04-19  8:18 ` Srivatsa S. Bhat [this message]
2012-04-19  8:30   ` Srivatsa S. Bhat
2012-04-19 11:02   ` Borislav Petkov
2012-04-19 11:02     ` Borislav Petkov
2012-04-19 11:14     ` Srivatsa S. Bhat
2012-04-19 11:26       ` Srivatsa S. Bhat
2012-04-19 11:44     ` Dan Carpenter
2012-04-19 11:44       ` Dan Carpenter
2012-04-19 16:53       ` [GIT PULL] L3 CID fix for 3.5 Borislav Petkov
2012-04-19 16:53         ` Borislav Petkov
2012-04-25  9:30         ` Borislav Petkov
2012-04-25  9:30           ` Borislav Petkov
2012-04-25 10:23           ` Ingo Molnar
2012-04-25 10:23             ` Ingo Molnar
2012-04-25 10:35             ` Borislav Petkov
2012-04-25 10:35               ` Borislav Petkov
2012-04-25 13:50 ` [tip:x86/urgent] x86, intel_cacheinfo: Fix error return code in amd_set_l3_disable_slot() tip-bot for Srivatsa S. Bhat

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=4F8FCA3A.5060504@linux.vnet.ibm.com \
    --to=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=borislav.petkov@amd.com \
    --cc=dan.carpenter@oracle.com \
    --cc=frank.arnold@amd.com \
    --cc=hpa@zytor.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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.