Skip to contentSkip to conversation

mmc: block: propagate correct returned value in mmc_rpmb_ioctl

PATCH Applied Mathieu Malaterre 3 participants 5 messages May 16, 2018 – May 21, 2018 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: block: propagate correct returned value in mmc_rpmb_ioctl

In commit 97548575bef3 ("mmc: block: Convert RPMB to a character device") a new function mmc_rpmb_ioctl was added. The final return is simply returning a value of 0 instead of propagating the correct return code.

Discovered during a compilation with W=1, silence the following gcc warning

drivers/mmc/core/block.c:2470:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

---
 drivers/mmc/core/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/block.c +1 -1
index 9e923cd1d80e..38a7586b00cc 100644
@@ -2485,7 +2485,7 @@ static long mmc_rpmb_ioctl(struct file *filp, unsigned int cmd,
 		break;
 	}
 
-	return 0;
+	return ret;
 }
 
 #ifdef CONFIG_COMPAT
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Mathieu Malaterre

In commit 97548575bef3 ("mmc: block: Convert RPMB to a character device") a new function mmc_rpmb_ioctl was added. The final return is simply returning a value of 0 instead of propagating the correct return code.

Discovered during a compilation with W=1, silence the following gcc warning

drivers/mmc/core/block.c:2470:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

Good catch! But hey, which gcc are you using now? Mine, gcc-linaro- 6.3.1-2017.05-x86_64_aarch64-linux-gnu, with W=1 doesn't warn about this. And it's worth backporting to stable.

Quoted 19 lines
---
  drivers/mmc/core/block.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/block.c +1 -1
index 9e923cd1d80e..38a7586b00cc 100644
@@ -2485,7 +2485,7 @@ static long mmc_rpmb_ioctl(struct file *filp, unsigned int cmd,
  		break;
  	}
 
-	return 0;
+	return ret;
  }
 
  #ifdef CONFIG_COMPAT
#2 lore raw
Quoted 11 lines · Shawn Lin
Quoted 9 lines · Mathieu Malaterre

In commit 97548575bef3 ("mmc: block: Convert RPMB to a character device") a
new function mmc_rpmb_ioctl was added. The final return is simply returning a value of 0 instead of propagating the correct return code.

Discovered during a compilation with W=1, silence the following gcc warning

Quoted 7 lines
Quoted 3 lines

drivers/mmc/core/block.c:2470:6: warning: variable ‘ret’ set but not
used [-Wunused-but-set-variable]

Good catch! But hey, which gcc are you using now? Mine, gcc-linaro- 6.3.1-2017.05-x86_64_aarch64-linux-gnu, with W=1 doesn't warn about this.

$ powerpc-linux-gnu-gcc --version
powerpc-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This is the default powerpc cross compiler on Debian stable (no change). Config is simply a ppc32 (with some minor customization).

Quoted 1 line

And it's worth backporting to stable.

I am not familiar with the process, do I need to submit a v2 to add the line:

Cc <[email protected]> # v4.15+

?

Quoted 22 lines
Quoted 18 lines
---
  drivers/mmc/core/block.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/block.c +1 -0
index 9e923cd1d80e..38a7586b00cc 100644
@@ -2485,7 +2485,7 @@ static long mmc_rpmb_ioctl(struct file *filp,
 unsigned int cmd,
                break;
        }
  -     return 0;
+       return ret;
  }
    #ifdef CONFIG_COMPAT
#3 lore raw
Quoted 20 lines · Mathieu Malaterre
Quoted 11 lines · Shawn Lin
Quoted 9 lines · Mathieu Malaterre

In commit 97548575bef3 ("mmc: block: Convert RPMB to a character device") a
new function mmc_rpmb_ioctl was added. The final return is simply returning a value of 0 instead of propagating the correct return code.

Discovered during a compilation with W=1, silence the following gcc warning

Quoted 7 lines
Quoted 3 lines

drivers/mmc/core/block.c:2470:6: warning: variable ‘ret’ set but not
used [-Wunused-but-set-variable]

Good catch! But hey, which gcc are you using now? Mine, gcc-linaro- 6.3.1-2017.05-x86_64_aarch64-linux-gnu, with W=1 doesn't warn about this.

Quoted 6 lines
$ powerpc-linux-gnu-gcc --version
powerpc-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks for sharing.

Quoted 10 lines

This is the default powerpc cross compiler on Debian stable (no change). Config is simply a ppc32 (with some minor customization).

Quoted 1 line

And it's worth backporting to stable.

I am not familiar with the process, do I need to submit a v2 to add the line:

Cc <[email protected]> # v4.15+

In general Ulf could kindly help with it when applied. :)

Quoted 31 lines

?

Quoted 8 lines
Quoted 5 lines
---
   drivers/mmc/core/block.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/mmc/core/block.c static long mmc_rpmb_ioctl(struct file *filp, · line 2491

Quoted 13 lines
drivers/mmc/core/block.c +1 -0
index 9e923cd1d80e..38a7586b00cc 100644
@@ -2485,7 +2485,7 @@ static long mmc_rpmb_ioctl(struct file *filp,
 unsigned int cmd,
                 break;
         }
   -     return 0;
+       return ret;
   }
     #ifdef CONFIG_COMPAT

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#4 lore raw
In reply to Mathieu Malaterre
Quoted 9 lines · Mathieu Malaterre

In commit 97548575bef3 ("mmc: block: Convert RPMB to a character device") a new function mmc_rpmb_ioctl was added. The final return is simply returning a value of 0 instead of propagating the correct return code.

Discovered during a compilation with W=1, silence the following gcc warning

drivers/mmc/core/block.c:2470:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

Thanks, applied for fixes and by adding a stable tag!

Kind regards
Uffe

Quoted 20 lines
---
 drivers/mmc/core/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/block.c +1 -2
index 9e923cd1d80e..38a7586b00cc 100644
@@ -2485,7 +2485,7 @@ static long mmc_rpmb_ioctl(struct file *filp, unsigned int cmd,
                break;
        }
 
-       return 0;
+       return ret;
 }
 
 #ifdef CONFIG_COMPAT
--

2.11.0