MIPS: Fix GCC-4.6 ‘set but not used’ warning in signal*.c [Linux 2.6.38]

This Linux kernel change "MIPS: Fix GCC-4.6 ‘set but not used’ warning in signal*.c" is included in the Linux 2.6.38 release. This change is authored by David Daney <ddaney [at] caviumnetworks.com> on Mon Jan 24 14:51:34 2011 -0800. The commit for this change in Linux stable tree is c726b82 (patch).

MIPS: Fix GCC-4.6 'set but not used' warning in signal*.c

GCC-4.6 can find more unused code than previous versions could.

In the case of protected_restore_fp_context{,32}, the variable tmp is
really used.  Its use is tricky in that we really care about the side
effects of the __put_user() calls.  So we must mark tmp with
__maybe_unused to quiet the warning.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2035/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 arch/mips/kernel/signal.c   | 2 +-
 arch/mips/kernel/signal32.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 5922342..dbbe0ce 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -84,7 +84,7 @@ static int protected_save_fp_context(struct sigcontext __user *sc)

 static int protected_restore_fp_context(struct sigcontext __user *sc)
-   int err, tmp;
+   int err, tmp __maybe_unused;
    while (1) {
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index a0ed0e0..aae9866 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -115,7 +115,7 @@ static int protected_save_fp_context32(struct sigcontext32 __user *sc)

 static int protected_restore_fp_context32(struct sigcontext32 __user *sc)
-   int err, tmp;
+   int err, tmp __maybe_unused;
    while (1) {

Leave a Reply

Your email address will not be published. Required fields are marked *