public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: quiet unused variable warnings
@ 2022-08-04 17:15 Andreas Dilger
  2022-08-04 21:05 ` Andreas Dilger
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Dilger @ 2022-08-04 17:15 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Andreas Dilger

Quiet unreferenced variable warning if jbd_debug() is a no-op.
Quiet unset variable warning because compiler is dumb.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
---
 e2fsck/journal.c    | 15 +++++++--------
 lib/ext2fs/swapfs.c |  2 +-
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 12487e3d..571de83e 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -620,7 +620,6 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
 			     struct  ext4_fc_tl *tl, __u8 *val)
 {
 	struct ext4_fc_dentry_info fcd;
-	int tag = le16_to_cpu(tl->fc_tag);
 
 	memcpy(&fcd, val, sizeof(fcd));
 
@@ -636,10 +635,10 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
 	       darg->dname_len);
 	darg->dname[darg->dname_len] = 0;
 	jbd_debug(1, "%s: %s, ino %lu, parent %lu\n",
-		tag == EXT4_FC_TAG_CREAT ? "create" :
-		(tag == EXT4_FC_TAG_LINK ? "link" :
-		(tag == EXT4_FC_TAG_UNLINK ? "unlink" : "error")),
-		darg->dname, darg->ino, darg->parent_ino);
+		  le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_CREAT ? "create" :
+		  (le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_LINK ? "link" :
+		   (le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_UNLINK ? "unlink" :
+		    "error")), darg->dname, darg->ino, darg->parent_ino);
 	return 0;
 }
 
@@ -652,11 +651,11 @@ static int ext4_fc_handle_unlink(e2fsck_t ctx, struct ext4_fc_tl *tl, __u8 *val)
 	if (ret)
 		return ret;
 	ext4_fc_flush_extents(ctx, darg.ino);
-	ret = errcode_to_errno(
-		       ext2fs_unlink(ctx->fs, darg.parent_ino,
-				     darg.dname, darg.ino, 0));
+	ret = errcode_to_errno(ext2fs_unlink(ctx->fs, darg.parent_ino,
+					     darg.dname, darg.ino, 0));
 	/* It's okay if the above call fails */
 	free(darg.dname);
+
 	return ret;
 }
 
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 1006b2d2..cd160b31 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -244,7 +244,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
 			    int bufsize)
 {
 	unsigned i, extra_isize, attr_magic;
-	int has_extents, has_inline_data, islnk, fast_symlink;
+	int has_extents = 0, has_inline_data = 0, islnk = 0, fast_symlink = 0;
 	unsigned int inode_size;
 	__u32 *eaf, *eat;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] misc: quiet unused variable warnings
@ 2022-08-04 17:18 Andreas Dilger
  2022-08-11 14:32 ` Theodore Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Dilger @ 2022-08-04 17:18 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Andreas Dilger

Quiet compiler warnings about unreferenced or unset variables.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
---
 e2fsck/journal.c    | 15 +++++++--------
 lib/ext2fs/swapfs.c |  2 +-
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 12487e3d..571de83e 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -620,7 +620,6 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
 			     struct  ext4_fc_tl *tl, __u8 *val)
 {
 	struct ext4_fc_dentry_info fcd;
-	int tag = le16_to_cpu(tl->fc_tag);
 
 	memcpy(&fcd, val, sizeof(fcd));
 
@@ -636,10 +635,10 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
 	       darg->dname_len);
 	darg->dname[darg->dname_len] = 0;
 	jbd_debug(1, "%s: %s, ino %lu, parent %lu\n",
-		tag == EXT4_FC_TAG_CREAT ? "create" :
-		(tag == EXT4_FC_TAG_LINK ? "link" :
-		(tag == EXT4_FC_TAG_UNLINK ? "unlink" : "error")),
-		darg->dname, darg->ino, darg->parent_ino);
+		  le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_CREAT ? "create" :
+		  (le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_LINK ? "link" :
+		   (le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_UNLINK ? "unlink" :
+		    "error")), darg->dname, darg->ino, darg->parent_ino);
 	return 0;
 }
 
@@ -652,11 +651,11 @@ static int ext4_fc_handle_unlink(e2fsck_t ctx, struct ext4_fc_tl *tl, __u8 *val)
 	if (ret)
 		return ret;
 	ext4_fc_flush_extents(ctx, darg.ino);
-	ret = errcode_to_errno(
-		       ext2fs_unlink(ctx->fs, darg.parent_ino,
-				     darg.dname, darg.ino, 0));
+	ret = errcode_to_errno(ext2fs_unlink(ctx->fs, darg.parent_ino,
+					     darg.dname, darg.ino, 0));
 	/* It's okay if the above call fails */
 	free(darg.dname);
+
 	return ret;
 }
 
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 1006b2d2..cd160b31 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -244,7 +244,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
 			    int bufsize)
 {
 	unsigned i, extra_isize, attr_magic;
-	int has_extents, has_inline_data, islnk, fast_symlink;
+	int has_extents = 0, has_inline_data = 0, islnk = 0, fast_symlink = 0;
 	unsigned int inode_size;
 	__u32 *eaf, *eat;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] misc: quiet unused variable warnings
  2022-08-04 17:15 [PATCH] misc: quiet unused variable warnings Andreas Dilger
@ 2022-08-04 21:05 ` Andreas Dilger
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Dilger @ 2022-08-04 21:05 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: tytso, linux-ext4

Sorry about the duplicate patch, I got an error sending from my one laptop and thought it didn't go out. 

Cheers, Andreas

On Aug 4, 2022, at 11:16, Andreas Dilger <adilger@whamcloud.com> wrote:
> 
> Quiet unreferenced variable warning if jbd_debug() is a no-op.
> Quiet unset variable warning because compiler is dumb.
> 
> Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
> ---
> e2fsck/journal.c    | 15 +++++++--------
> lib/ext2fs/swapfs.c |  2 +-
> 2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/e2fsck/journal.c b/e2fsck/journal.c
> index 12487e3d..571de83e 100644
> --- a/e2fsck/journal.c
> +++ b/e2fsck/journal.c
> @@ -620,7 +620,6 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
>                 struct  ext4_fc_tl *tl, __u8 *val)
> {
>    struct ext4_fc_dentry_info fcd;
> -    int tag = le16_to_cpu(tl->fc_tag);
> 
>    memcpy(&fcd, val, sizeof(fcd));
> 
> @@ -636,10 +635,10 @@ static inline int tl_to_darg(struct dentry_info_args *darg,
>           darg->dname_len);
>    darg->dname[darg->dname_len] = 0;
>    jbd_debug(1, "%s: %s, ino %lu, parent %lu\n",
> -        tag == EXT4_FC_TAG_CREAT ? "create" :
> -        (tag == EXT4_FC_TAG_LINK ? "link" :
> -        (tag == EXT4_FC_TAG_UNLINK ? "unlink" : "error")),
> -        darg->dname, darg->ino, darg->parent_ino);
> +          le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_CREAT ? "create" :
> +          (le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_LINK ? "link" :
> +           (le16_to_cpu(tl->fc_tag) == EXT4_FC_TAG_UNLINK ? "unlink" :
> +            "error")), darg->dname, darg->ino, darg->parent_ino);
>    return 0;
> }
> 
> @@ -652,11 +651,11 @@ static int ext4_fc_handle_unlink(e2fsck_t ctx, struct ext4_fc_tl *tl, __u8 *val)
>    if (ret)
>        return ret;
>    ext4_fc_flush_extents(ctx, darg.ino);
> -    ret = errcode_to_errno(
> -               ext2fs_unlink(ctx->fs, darg.parent_ino,
> -                     darg.dname, darg.ino, 0));
> +    ret = errcode_to_errno(ext2fs_unlink(ctx->fs, darg.parent_ino,
> +                         darg.dname, darg.ino, 0));
>    /* It's okay if the above call fails */
>    free(darg.dname);
> +
>    return ret;
> }
> 
> diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
> index 1006b2d2..cd160b31 100644
> --- a/lib/ext2fs/swapfs.c
> +++ b/lib/ext2fs/swapfs.c
> @@ -244,7 +244,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
>                int bufsize)
> {
>    unsigned i, extra_isize, attr_magic;
> -    int has_extents, has_inline_data, islnk, fast_symlink;
> +    int has_extents = 0, has_inline_data = 0, islnk = 0, fast_symlink = 0;
>    unsigned int inode_size;
>    __u32 *eaf, *eat;
> 
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] misc: quiet unused variable warnings
  2022-08-04 17:18 Andreas Dilger
@ 2022-08-11 14:32 ` Theodore Ts'o
  0 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2022-08-11 14:32 UTC (permalink / raw)
  To: adilger; +Cc: Theodore Ts'o, linux-ext4

On Thu, 4 Aug 2022 11:18:32 -0600, Andreas Dilger wrote:
> Quiet compiler warnings about unreferenced or unset variables.
> 

Applied, thanks!

[1/1] misc: quiet unused variable warnings
      commit: 9d8b56b3b5d59691f16a8b8ae5fb763bc6be3d15

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-11 14:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-04 17:15 [PATCH] misc: quiet unused variable warnings Andreas Dilger
2022-08-04 21:05 ` Andreas Dilger
  -- strict thread matches above, loose matches on Subject: below --
2022-08-04 17:18 Andreas Dilger
2022-08-11 14:32 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox