Re: [RFC V2 4/6] sh/mm: Stop using [p4d|pud|pmd]_ERROR()
Anshuman Khandual <[email protected]>
| Newsgroups | gmane.linux.ports.riscv,gmane.linux.kernel.mm,gmane.linux.ports.alpha,gmane.linux.kernel.arc,gmane.linux.ports.arm.kernel,gmane.linux.ports.hexagon,gmane.linux.ports.mips,gmane.linux.ports.parisc,gmane.linux.ports.ppc64.devel,gmane.linux.ports.sh.devel,gmane.linux.ports.sparc,gmane.linux.uml.devel,gmane.linux.kernel.cross-arch,gmane.linux.kernel |
|---|---|
| Message-ID | <3bruvrvxg5blgzuhqg2f27yvfjvvsycx6lmt3jcianvpuqcs5n@zdgzfhmmhvom> |
On Wed, Aug 12, 2026 at 01:21:28PM +0200, David Hildenbrand (Arm) wrote: > On 8/11/26 06:21, Anshuman Khandual wrote: > > Stop using [p4d|pud|pmd]_ERROR() in __get_pte_phys() as the pgtable entries > > are known to be NULL and hence could not really be accessed. > > > > Cc: Yoshinori Sato <[email protected]> > > Cc: Rich Felker <[email protected]> > > Cc: John Paul Adrian Glaubitz <[email protected]> > > Cc: [email protected] > > Cc: [email protected] > > Signed-off-by: Anshuman Khandual <[email protected]> > > --- > > arch/sh/mm/init.c | 12 +++--------- > > 1 file changed, 3 insertions(+), 9 deletions(-) > > > > diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c > > index b3c7fd84ceb4..0bb8555568a4 100644 > > --- a/arch/sh/mm/init.c > > +++ b/arch/sh/mm/init.c > > @@ -58,22 +58,16 @@ static pte_t *__get_pte_phys(unsigned long addr) > > } > > > > p4d = p4d_alloc(NULL, pgd, addr); > > - if (unlikely(!p4d)) { > > - p4d_ERROR(*p4d); > > + if (unlikely(!p4d)) > > return NULL; > > - } > > > > pud = pud_alloc(NULL, p4d, addr); > > - if (unlikely(!pud)) { > > - pud_ERROR(*pud); > > + if (unlikely(!pud)) > > return NULL; > > - } > > > > pmd = pmd_alloc(NULL, pud, addr); > > - if (unlikely(!pmd)) { > > - pmd_ERROR(*pmd); > > + if (unlikely(!pmd)) > > return NULL; > > - } > > > > return pte_offset_kernel(pmd, addr); > > } > > Do we want to print an error like "allocating p4d table failed"? Sure, will add error prints like the following. --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -56,16 +56,22 @@ static pte_t *__get_pte_phys(unsigned long addr) return NULL; p4d = p4d_alloc(NULL, pgd, addr); - if (unlikely(!p4d)) + if (unlikely(!p4d)) { + pr_err("allocating p4d table failed\n"); return NULL; + } pud = pud_alloc(NULL, p4d, addr); - if (unlikely(!pud)) + if (unlikely(!pud)) { + pr_err("allocating pud table failed\n"); return NULL; + } pmd = pmd_alloc(NULL, pud, addr); - if (unlikely(!pmd)) + if (unlikely(!pmd)) { + pr_err("allocating pmd table failed\n"); return NULL; + } return pte_offset_kernel(pmd, addr); } > > Reviewed-by: David Hildenbrand (Arm) <[email protected]> > > -- > Cheers, > > David