powerpc/mm: dump block address translation on book3s/32
Hello Christophe Leroy,
The patch 7c91efce1608: "powerpc/mm: dump block address translation on book3s/32" from Dec 3, 2018, leads to the following static checker warning:
arch/powerpc/mm/dump_bats.c:20 pp_601() warn: both sides of ternary the same: '"RWX"'
arch/powerpc/mm/dump_bats.c
13 static char *pp_601(int k, int pp)
14 {
15 if (pp == 0)
16 return k ? "NA" : "RWX";
17 if (pp == 1)
18 return k ? "ROX" : "RWX";
19 if (pp == 2)
--> 20 return k ? "RWX" : "RWX";
^^^ ^^^
21 return k ? "ROX" : "ROX";
^^^ ^^^Was something else intended here? Or we could make it simpler:
if (pp == 2)
return "RWX";
return "ROX";
22 }regards,
dan carpenter
Hello Dan,
Le 22/02/2019 à 11:43, Dan Carpenter a écrit :
Quoted 22 lines
Hello Christophe Leroy,
The patch
7c91efce1608: "powerpc/mm: dump block address translation on book3s/32" from Dec 3, 2018, leads to the following static checker warning:arch/powerpc/mm/dump_bats.c:20 pp_601() warn: both sides of ternary the same: '"RWX"'
arch/powerpc/mm/dump_bats.c13 static char *pp_601(int k, int pp) 14 { 15 if (pp == 0) 16 return k ? "NA" : "RWX"; 17 if (pp == 1) 18 return k ? "ROX" : "RWX"; 19 if (pp == 2) --> 20 return k ? "RWX" : "RWX"; ^^^ ^^^ 21 return k ? "ROX" : "ROX"; ^^^ ^^^
Quoted 9 lines
Was something else intended here? Or we could make it simpler:
if (pp == 2) return "RWX"; return "ROX"; 22 }
The intention was to map the following table from the mpc601 user manual chapter 6.4:
Table 6-7. Access Protection Control with Key
Key(1) PP(2) Block or Page Type 0 00 Read/write 0 01 Read/write 0 10 Read/write 0 11 Read only 1 00 No access 1 01 Read only 1 10 Read/write 1 11 Read only
(1) Ks or Ku selected by state of MSR[PR]
(2) PP protection option bits in BAT array entry or PTE
So I have no objection for your proposed change
Regards
Christophe