* [PATCH] staging: lustre: fid: lproc_fid: Removed variables that is never used
@ 2015-01-28 22:46 Rickard Strandqvist
2015-01-28 23:15 ` [HPDD-discuss] " Frank Zago
2015-01-29 1:22 ` Joe Perches
0 siblings, 2 replies; 3+ messages in thread
From: Rickard Strandqvist @ 2015-01-28 22:46 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger
Cc: Rickard Strandqvist, Greg Kroah-Hartman, Dmitry Eremin,
Eddie Kovsky, Anil Belur, HPDD-discuss, devel, linux-kernel
Variable ar assigned a value that is never used.
I have also removed all the code that thereby serves no purpose.
This was found using a static code analysis program called cppcheck
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
drivers/staging/lustre/lustre/fid/lproc_fid.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c
index 6a21f07..feb7425 100644
--- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
+++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
@@ -63,7 +63,6 @@ static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
struct lu_seq_range *range)
{
struct lu_seq_range tmp;
- int rc;
char kernbuf[MAX_FID_RANGE_STRLEN];
LASSERT(range != NULL);
@@ -82,7 +81,7 @@ static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
}
/* of the form "[0x0000000240000400 - 0x000000028000400]" */
- rc = sscanf(kernbuf, "[%llx - %llx]\n",
+ sscanf(kernbuf, "[%llx - %llx]\n",
(unsigned long long *)&tmp.lsr_start,
(unsigned long long *)&tmp.lsr_end);
if (!range_is_sane(&tmp) || range_is_zero(&tmp) ||
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [HPDD-discuss] [PATCH] staging: lustre: fid: lproc_fid: Removed variables that is never used
2015-01-28 22:46 [PATCH] staging: lustre: fid: lproc_fid: Removed variables that is never used Rickard Strandqvist
@ 2015-01-28 23:15 ` Frank Zago
2015-01-29 1:22 ` Joe Perches
1 sibling, 0 replies; 3+ messages in thread
From: Frank Zago @ 2015-01-28 23:15 UTC (permalink / raw)
To: Rickard Strandqvist, Oleg Drokin, Andreas Dilger
Cc: devel, Greg Kroah-Hartman, linux-kernel, HPDD-discuss,
Eddie Kovsky, Anil Belur
On 01/28/2015 04:46 PM, Rickard Strandqvist wrote:
> Variable ar assigned a value that is never used.
s/ar/rc/
> I have also removed all the code that thereby serves no purpose.
>
> This was found using a static code analysis program called cppcheck
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/staging/lustre/lustre/fid/lproc_fid.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c
> index 6a21f07..feb7425 100644
> --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c
> +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c
> @@ -63,7 +63,6 @@ static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
> struct lu_seq_range *range)
> {
> struct lu_seq_range tmp;
> - int rc;
> char kernbuf[MAX_FID_RANGE_STRLEN];
>
> LASSERT(range != NULL);
> @@ -82,7 +81,7 @@ static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
> }
>
> /* of the form "[0x0000000240000400 - 0x000000028000400]" */
> - rc = sscanf(kernbuf, "[%llx - %llx]\n",
> + sscanf(kernbuf, "[%llx - %llx]\n",
I would test rc instead:
if (rc != 2)
return -EINVAL;
Regards,
Frank.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: lustre: fid: lproc_fid: Removed variables that is never used
2015-01-28 22:46 [PATCH] staging: lustre: fid: lproc_fid: Removed variables that is never used Rickard Strandqvist
2015-01-28 23:15 ` [HPDD-discuss] " Frank Zago
@ 2015-01-29 1:22 ` Joe Perches
1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2015-01-29 1:22 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman, Dmitry Eremin,
Eddie Kovsky, Anil Belur, HPDD-discuss, devel, linux-kernel
On Wed, 2015-01-28 at 23:46 +0100, Rickard Strandqvist wrote:
> Variable ar assigned a value that is never used.
> I have also removed all the code that thereby serves no purpose.
[]
> diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c
[]
> @@ -63,7 +63,6 @@ static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
> struct lu_seq_range *range)
> {
> struct lu_seq_range tmp;
> - int rc;
> char kernbuf[MAX_FID_RANGE_STRLEN];
>
> LASSERT(range != NULL);
> @@ -82,7 +81,7 @@ static int lprocfs_fid_write_common(const char __user *buffer, size_t count,
> }
>
> /* of the form "[0x0000000240000400 - 0x000000028000400]" */
> - rc = sscanf(kernbuf, "[%llx - %llx]\n",
> + sscanf(kernbuf, "[%llx - %llx]\n",
> (unsigned long long *)&tmp.lsr_start,
> (unsigned long long *)&tmp.lsr_end);
> if (!range_is_sane(&tmp) || range_is_zero(&tmp) ||
Better to make this test use rc rather than
ignore the return from sscanf
if (rc != 2 || !range_is_sane(etc...))
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-29 2:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 22:46 [PATCH] staging: lustre: fid: lproc_fid: Removed variables that is never used Rickard Strandqvist
2015-01-28 23:15 ` [HPDD-discuss] " Frank Zago
2015-01-29 1:22 ` Joe Perches
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.