lkml.org 
[lkml]   [2019]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1 03/27] powerpc/mm: don't BUG() in slice_mask_for_size()
From
Date


Le 11/04/2019 à 07:41, Aneesh Kumar K.V a écrit :
> Christophe Leroy <christophe.leroy@c-s.fr> writes:
>
>> When no mask is found for the page size, WARN() and return NULL
>> instead of BUG()ing.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>> ---
>> arch/powerpc/mm/slice.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
>> index aec91dbcdc0b..011d470ea340 100644
>> --- a/arch/powerpc/mm/slice.c
>> +++ b/arch/powerpc/mm/slice.c
>> @@ -165,7 +165,8 @@ static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize)
>> if (psize == MMU_PAGE_16G)
>> return &mm->context.mask_16g;
>> #endif
>> - BUG();
>> + WARN_ON(true);
>> + return NULL;
>> }
>
>
> Same here. There are not catching runtime errors. We should never find
> that true. This is to catch mistakes during development changes. Switch
> to VM_BUG_ON?

Ok, I'll switch to VM_BUG_ON()

Christophe

>
>
>> #elif defined(CONFIG_PPC_8xx)
>> static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize)
>> @@ -178,7 +179,8 @@ static struct slice_mask *slice_mask_for_size(struct mm_struct *mm, int psize)
>> if (psize == MMU_PAGE_8M)
>> return &mm->context.mask_8m;
>> #endif
>> - BUG();
>> + WARN_ON(true);
>> + return NULL;
>> }
>> #else
>> #error "Must define the slice masks for page sizes supported by the platform"
>> --
>> 2.13.3

\
 
 \ /
  Last update: 2019-04-24 16:10    [W:0.074 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site