Skip to contentSkip to conversation

Fix a warning in lib-64/dump_tlb.c

PATCH In review Florian Fainelli 3 participants 5 messages Mar 16, 2007 – Mar 26, 2007 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix a warning in lib-64/dump_tlb.c

Hi all,

This patch suppresses a warning in arch/mips/lib-64/dump_tlb.c

-----

arch/mips/lib-64/dump_tlb.c +1 -0
index 8232900..60a87c5 100644
@@ -30,6 +30,7 @@ static inline const char *msk2str(unsigned int mask)
        case PM_64M:    return "64Mb";
        case PM_256M:   return "256Mb";
 #endif
+       default:        return NULL;
        }
 }
#1 lore raw
Quoted 10 lines · Florian Fainelli

This patch suppresses a warning in arch/mips/lib-64/dump_tlb.c

-----

arch/mips/lib-64/dump_tlb.c +0 -0
index 8232900..60a87c5 100644

arch/mips/lib-64/dump_tlb.c static inline const char *msk2str(unsigned int mask) · line 35

Quoted 6 lines
arch/mips/lib-64/dump_tlb.c +1 -0
@@ -30,6 +30,7 @@ static inline const char *msk2str(unsigned int mask)
        case PM_64M:    return "64Mb";
        case PM_256M:   return "256Mb";
 #endif
+       default:        return NULL;
        }
 }

I guess BUG() would be appropriate here.

Maciej

#2 lore raw
Quoted 6 lines · Maciej W. Rozycki
Quoted 4 lines · Florian Fainelli

This patch suppresses a warning in arch/mips/lib-64/dump_tlb.c

Quoted 14 lines

arch/mips/lib-64/dump_tlb.c static inline const char *msk2str(unsigned int mask) · line 35

Quoted 12 lines

-----

arch/mips/lib-64/dump_tlb.c +1 -0
index 8232900..60a87c5 100644
@@ -30,6 +30,7 @@ static inline const char *msk2str(unsigned int mask)
        case PM_64M:    return "64Mb";
        case PM_256M:   return "256Mb";
 #endif
+       default:        return NULL;
        }
 }

I guess BUG() would be appropriate here.

AFAICS NULL is wrong, it could cause the printk to crash.

Thiemo

#3 lore raw

Hello,

Here is the patch taking into account your remarks. Thanks !

------

arch/mips/lib-64/dump_tlb.c +1 -0
index 8232900..a320944 100644
@@ -30,6 +30,7 @@ static inline const char *msk2str(unsigned int mask)
        case PM_64M:    return "64Mb";
        case PM_256M:   return "256Mb";
 #endif
+       default:        BUG();
        }
 }
#4 lore raw

Forgot including bug.h. Final fix :

------

arch/mips/lib-64/dump_tlb.c +2 -0
index 8232900..a2a12ee 100644
@@ -15,6 +15,7 @@
 #include <asm/mipsregs.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
+#include <asm/bug.h>
 
 static inline const char *msk2str(unsigned int mask)
 {
@@ -30,6 +31,7 @@ static inline const char *msk2str(unsigned int mask)
        case PM_64M:    return "64Mb";
        case PM_256M:   return "256Mb";
 #endif
+       default:        BUG();
        }
 }
 

Le lundi 26 mars 2007, Florian Fainelli a écrit :

Quoted 17 lines

Hello,

Here is the patch taking into account your remarks. Thanks !

------

arch/mips/lib-64/dump_tlb.c +1 -0
index 8232900..a320944 100644
@@ -30,6 +30,7 @@ static inline const char *msk2str(unsigned int mask)
        case PM_64M:    return "64Mb";
        case PM_256M:   return "256Mb";
 #endif
+       default:        BUG();
        }
 }