2020-11-08 07:59:26

by Alex Shi

[permalink] [raw]
Subject: [PATCH] fs/ntfs: remove unused varible attr_len

This varible isn't used anymore, remove it to skip W=1 warning:
fs/ntfs/inode.c:2350:6: warning: variable ‘attr_len’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Alex Shi <[email protected]>
Cc: Anton Altaparmakov <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
fs/ntfs/inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index caf563981532..d3127ea201ec 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2347,7 +2347,6 @@ int ntfs_truncate(struct inode *vi)
ATTR_RECORD *a;
const char *te = " Leaving file length out of sync with i_size.";
int err, mp_size, size_change, alloc_change;
- u32 attr_len;

ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
BUG_ON(NInoAttr(ni));
@@ -2721,7 +2720,7 @@ int ntfs_truncate(struct inode *vi)
* this cannot fail since we are making the attribute smaller thus by
* definition there is enough space to do so.
*/
- attr_len = le32_to_cpu(a->length);
+ le32_to_cpu(a->length);
err = ntfs_attr_record_resize(m, a, mp_size +
le16_to_cpu(a->data.non_resident.mapping_pairs_offset));
BUG_ON(err);
--
1.8.3.1


2020-11-08 08:09:52

by Alex Shi

[permalink] [raw]
Subject: Re: [PATCH] fs/ntfs: remove unused varible attr_len



在 2020/11/8 下午3:54, Alex Shi 写道:
> */
> - attr_len = le32_to_cpu(a->length);
> + le32_to_cpu(a->length);

This line is also useless. and should be removed. so:

From d1c6de723995adeeecb90c6fd77811dd85b697e6 Mon Sep 17 00:00:00 2001
From: Alex Shi <[email protected]>
Date: Sun, 8 Nov 2020 15:52:32 +0800
Subject: [PATCH] fs/ntfs: remove unused varible attr_len
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This varible isn't used anymore, remove it to skip W=1 warning:
fs/ntfs/inode.c:2350:6: warning: variable ‘attr_len’ set but not used
[-Wunused-but-set-variable]

Signed-off-by: Alex Shi <[email protected]>
---
fs/ntfs/inode.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index caf563981532..f7e4cbc26eaf 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2347,7 +2347,6 @@ int ntfs_truncate(struct inode *vi)
ATTR_RECORD *a;
const char *te = " Leaving file length out of sync with i_size.";
int err, mp_size, size_change, alloc_change;
- u32 attr_len;

ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
BUG_ON(NInoAttr(ni));
@@ -2721,7 +2720,6 @@ int ntfs_truncate(struct inode *vi)
* this cannot fail since we are making the attribute smaller thus by
* definition there is enough space to do so.
*/
- attr_len = le32_to_cpu(a->length);
err = ntfs_attr_record_resize(m, a, mp_size +
le16_to_cpu(a->data.non_resident.mapping_pairs_offset));
BUG_ON(err);
--
1.8.3.1

2020-11-10 01:02:09

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: [PATCH] fs/ntfs: remove unused varible attr_len

Hi Andrew,

Can you also please merge this one? Thanks a lot in advance!

Alex, again, thank you for the patch!

Best regards,

Anton

> On 8 Nov 2020, at 08:06, Alex Shi <[email protected]> wrote:
> From: Alex Shi <[email protected]>
> Date: Sun, 8 Nov 2020 15:52:32 +0800
> Subject: [PATCH] fs/ntfs: remove unused varible attr_len
>
> This varible isn't used anymore, remove it to skip W=1 warning:
> fs/ntfs/inode.c:2350:6: warning: variable ‘attr_len’ set but not used
> [-Wunused-but-set-variable]
>
> Signed-off-by: Alex Shi <[email protected]>
> Acked-by: Anton Altaparmakov <[email protected]>
> ---
> fs/ntfs/inode.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
> index caf563981532..f7e4cbc26eaf 100644
> --- a/fs/ntfs/inode.c
> +++ b/fs/ntfs/inode.c
> @@ -2347,7 +2347,6 @@ int ntfs_truncate(struct inode *vi)
> ATTR_RECORD *a;
> const char *te = " Leaving file length out of sync with i_size.";
> int err, mp_size, size_change, alloc_change;
> - u32 attr_len;
>
> ntfs_debug("Entering for inode 0x%lx.", vi->i_ino);
> BUG_ON(NInoAttr(ni));
> @@ -2721,7 +2720,6 @@ int ntfs_truncate(struct inode *vi)
> * this cannot fail since we are making the attribute smaller thus by
> * definition there is enough space to do so.
> */
> - attr_len = le32_to_cpu(a->length);
> err = ntfs_attr_record_resize(m, a, mp_size +
> le16_to_cpu(a->data.non_resident.mapping_pairs_offset));
> BUG_ON(err);
> --
> 1.8.3.1
>


--
Anton Altaparmakov <anton at tuxera.com> (replace at with @)
Lead in File System Development, Tuxera Inc., http://www.tuxera.com/
Linux NTFS maintainer