linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] xfs: Fix compiler warnings
@ 2020-07-27 20:06 Allison Collins
  2020-07-27 20:06 ` [PATCH v3 1/2] xfs: Fix compiler warning in xfs_attr_node_removename_setup Allison Collins
  2020-07-27 20:06 ` [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add Allison Collins
  0 siblings, 2 replies; 5+ messages in thread
From: Allison Collins @ 2020-07-27 20:06 UTC (permalink / raw)
  To: linux-xfs

Some variables added in the delayed attr series were only used in ASSERT
checks, and caused some compiler warnings.  This set fixes these warnings by
declaring them only when debug is set or removing the convenience variable.

Allison Collins (2):
  xfs: Fix compiler warning in xfs_attr_node_removename_setup
  xfs: Fix compiler warning in xfs_attr_shortform_add

 fs/xfs/libxfs/xfs_attr.c      | 7 +++----
 fs/xfs/libxfs/xfs_attr_leaf.c | 5 ++++-
 2 files changed, 7 insertions(+), 5 deletions(-)

-- 
2.7.4


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

* [PATCH v3 1/2] xfs: Fix compiler warning in xfs_attr_node_removename_setup
  2020-07-27 20:06 [PATCH v3 0/2] xfs: Fix compiler warnings Allison Collins
@ 2020-07-27 20:06 ` Allison Collins
  2020-07-27 20:06 ` [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add Allison Collins
  1 sibling, 0 replies; 5+ messages in thread
From: Allison Collins @ 2020-07-27 20:06 UTC (permalink / raw)
  To: linux-xfs

Fix compiler warning for variable 'blk' set but not used in
xfs_attr_node_removename_setup.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Allison Collins <allison.henderson@oracle.com>
---
 fs/xfs/libxfs/xfs_attr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index d4583a0..e5ec9ed 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -1174,15 +1174,14 @@ int xfs_attr_node_removename_setup(
 	struct xfs_da_state	**state)
 {
 	int			error;
-	struct xfs_da_state_blk	*blk;
 
 	error = xfs_attr_node_hasname(args, state);
 	if (error != -EEXIST)
 		return error;
 
-	blk = &(*state)->path.blk[(*state)->path.active - 1];
-	ASSERT(blk->bp != NULL);
-	ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
+	ASSERT((*state)->path.blk[(*state)->path.active - 1].bp != NULL);
+	ASSERT((*state)->path.blk[(*state)->path.active - 1].magic ==
+		XFS_ATTR_LEAF_MAGIC);
 
 	if (args->rmtblkno > 0) {
 		error = xfs_attr_leaf_mark_incomplete(args, *state);
-- 
2.7.4


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

* [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add
  2020-07-27 20:06 [PATCH v3 0/2] xfs: Fix compiler warnings Allison Collins
  2020-07-27 20:06 ` [PATCH v3 1/2] xfs: Fix compiler warning in xfs_attr_node_removename_setup Allison Collins
@ 2020-07-27 20:06 ` Allison Collins
  2020-07-27 21:58   ` Eric Sandeen
  1 sibling, 1 reply; 5+ messages in thread
From: Allison Collins @ 2020-07-27 20:06 UTC (permalink / raw)
  To: linux-xfs

Fix compiler warning warning: variable 'error' set but not used in
xfs_attr_shortform_add. error is used only in an ASSERT so only declare
error when DEBUG is set.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Allison Collins <allison.henderson@oracle.com>
---
 fs/xfs/libxfs/xfs_attr_leaf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
index ad7b351..db985b8 100644
--- a/fs/xfs/libxfs/xfs_attr_leaf.c
+++ b/fs/xfs/libxfs/xfs_attr_leaf.c
@@ -715,7 +715,10 @@ xfs_attr_shortform_add(
 {
 	struct xfs_attr_shortform	*sf;
 	struct xfs_attr_sf_entry	*sfe;
-	int				offset, size, error;
+	int				offset, size;
+#if DEBUG
+	int				error;
+#endif
 	struct xfs_mount		*mp;
 	struct xfs_inode		*dp;
 	struct xfs_ifork		*ifp;
-- 
2.7.4


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

* Re: [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add
  2020-07-27 20:06 ` [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add Allison Collins
@ 2020-07-27 21:58   ` Eric Sandeen
  2020-07-27 22:20     ` Allison Collins
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2020-07-27 21:58 UTC (permalink / raw)
  To: Allison Collins, linux-xfs

On 7/27/20 1:06 PM, Allison Collins wrote:
> Fix compiler warning warning: variable 'error' set but not used in
> xfs_attr_shortform_add. error is used only in an ASSERT so only declare
> error when DEBUG is set.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
> ---
>  fs/xfs/libxfs/xfs_attr_leaf.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

same problem...

you've made the existence of "error" conditional on DEBUG, but
then you unconditionally assign to it in the function:

	error = xfs_attr_sf_findname(args, &sfe, NULL);
        ASSERT(error != -EEXIST);

so this won't build.

-Eric

> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
> index ad7b351..db985b8 100644
> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
> @@ -715,7 +715,10 @@ xfs_attr_shortform_add(
>  {
>  	struct xfs_attr_shortform	*sf;
>  	struct xfs_attr_sf_entry	*sfe;
> -	int				offset, size, error;
> +	int				offset, size;
> +#if DEBUG
> +	int				error;
> +#endif
>  	struct xfs_mount		*mp;
>  	struct xfs_inode		*dp;
>  	struct xfs_ifork		*ifp;
> 

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

* Re: [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add
  2020-07-27 21:58   ` Eric Sandeen
@ 2020-07-27 22:20     ` Allison Collins
  0 siblings, 0 replies; 5+ messages in thread
From: Allison Collins @ 2020-07-27 22:20 UTC (permalink / raw)
  To: Eric Sandeen, linux-xfs



On 7/27/20 2:58 PM, Eric Sandeen wrote:
> On 7/27/20 1:06 PM, Allison Collins wrote:
>> Fix compiler warning warning: variable 'error' set but not used in
>> xfs_attr_shortform_add. error is used only in an ASSERT so only declare
>> error when DEBUG is set.
>>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Allison Collins <allison.henderson@oracle.com>
>> ---
>>   fs/xfs/libxfs/xfs_attr_leaf.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> same problem...
> 
> you've made the existence of "error" conditional on DEBUG, but
> then you unconditionally assign to it in the function:
> 
> 	error = xfs_attr_sf_findname(args, &sfe, NULL);
>          ASSERT(error != -EEXIST);
> 
> so this won't build.
Hmm, should I add some error handling back in then?  Maybe just
	if (error == -EEXIST)
		return;

Right after the ASSERT?  I think that makes all the compiler configs 
correct then?

Allison
> 
> -Eric
> 
>> diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c
>> index ad7b351..db985b8 100644
>> --- a/fs/xfs/libxfs/xfs_attr_leaf.c
>> +++ b/fs/xfs/libxfs/xfs_attr_leaf.c
>> @@ -715,7 +715,10 @@ xfs_attr_shortform_add(
>>   {
>>   	struct xfs_attr_shortform	*sf;
>>   	struct xfs_attr_sf_entry	*sfe;
>> -	int				offset, size, error;
>> +	int				offset, size;
>> +#if DEBUG
>> +	int				error;
>> +#endif
>>   	struct xfs_mount		*mp;
>>   	struct xfs_inode		*dp;
>>   	struct xfs_ifork		*ifp;
>>

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

end of thread, other threads:[~2020-07-27 22:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 20:06 [PATCH v3 0/2] xfs: Fix compiler warnings Allison Collins
2020-07-27 20:06 ` [PATCH v3 1/2] xfs: Fix compiler warning in xfs_attr_node_removename_setup Allison Collins
2020-07-27 20:06 ` [PATCH v3 2/2] xfs: Fix compiler warning in xfs_attr_shortform_add Allison Collins
2020-07-27 21:58   ` Eric Sandeen
2020-07-27 22:20     ` Allison Collins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).