From: Michael Ellerman <mpe@ellerman.id.au> To: Christophe Leroy <christophe.leroy@c-s.fr>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org> Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] powerpc/highmem: change BUG_ON() to WARN_ON() Date: Thu, 21 Mar 2019 16:29:59 +1100 [thread overview] Message-ID: <87va0c23s8.fsf@concordia.ellerman.id.au> (raw) In-Reply-To: <0365f99ce2b9273e269a241394957cba924f995e.1551951985.git.christophe.leroy@c-s.fr> Christophe Leroy <christophe.leroy@c-s.fr> writes: > In arch/powerpc/mm/highmem.c, BUG_ON() is called only when > CONFIG_DEBUG_HIGHMEM is selected, this means the BUG_ON() is > not vital and can be replaced by a a WARN_ON > > At the sametime, use IS_ENABLED() instead of #ifdef to clean a bit. > > Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> > --- > arch/powerpc/mm/highmem.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/mm/highmem.c b/arch/powerpc/mm/highmem.c > index 82a0e37557a5..b68c9f20fbdf 100644 > --- a/arch/powerpc/mm/highmem.c > +++ b/arch/powerpc/mm/highmem.c > @@ -56,7 +54,7 @@ EXPORT_SYMBOL(kmap_atomic_prot); > void __kunmap_atomic(void *kvaddr) > { > unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; > - int type __maybe_unused; > + int type; Why don't we move type into the block below. eg: > @@ -66,12 +64,11 @@ void __kunmap_atomic(void *kvaddr) > - type = kmap_atomic_idx(); > > -#ifdef CONFIG_DEBUG_HIGHMEM > - { > + if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM)) { int type = kmap_atomic_idx(); > unsigned int idx; > > idx = type + KM_TYPE_NR * smp_processor_id(); > - BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); > + WARN_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); cheers
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au> To: Christophe Leroy <christophe.leroy@c-s.fr>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org> Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/highmem: change BUG_ON() to WARN_ON() Date: Thu, 21 Mar 2019 16:29:59 +1100 [thread overview] Message-ID: <87va0c23s8.fsf@concordia.ellerman.id.au> (raw) In-Reply-To: <0365f99ce2b9273e269a241394957cba924f995e.1551951985.git.christophe.leroy@c-s.fr> Christophe Leroy <christophe.leroy@c-s.fr> writes: > In arch/powerpc/mm/highmem.c, BUG_ON() is called only when > CONFIG_DEBUG_HIGHMEM is selected, this means the BUG_ON() is > not vital and can be replaced by a a WARN_ON > > At the sametime, use IS_ENABLED() instead of #ifdef to clean a bit. > > Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> > --- > arch/powerpc/mm/highmem.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/mm/highmem.c b/arch/powerpc/mm/highmem.c > index 82a0e37557a5..b68c9f20fbdf 100644 > --- a/arch/powerpc/mm/highmem.c > +++ b/arch/powerpc/mm/highmem.c > @@ -56,7 +54,7 @@ EXPORT_SYMBOL(kmap_atomic_prot); > void __kunmap_atomic(void *kvaddr) > { > unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; > - int type __maybe_unused; > + int type; Why don't we move type into the block below. eg: > @@ -66,12 +64,11 @@ void __kunmap_atomic(void *kvaddr) > - type = kmap_atomic_idx(); > > -#ifdef CONFIG_DEBUG_HIGHMEM > - { > + if (IS_ENABLED(CONFIG_DEBUG_HIGHMEM)) { int type = kmap_atomic_idx(); > unsigned int idx; > > idx = type + KM_TYPE_NR * smp_processor_id(); > - BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); > + WARN_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); cheers
next prev parent reply other threads:[~2019-03-21 5:30 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-03-07 9:47 [PATCH] powerpc/highmem: change BUG_ON() to WARN_ON() Christophe Leroy 2019-03-07 9:47 ` Christophe Leroy 2019-03-21 5:29 ` Michael Ellerman [this message] 2019-03-21 5:29 ` Michael Ellerman 2019-03-21 6:00 ` Christophe Leroy 2019-03-21 6:00 ` Christophe Leroy 2019-03-21 10:07 ` Michael Ellerman 2019-03-21 10:07 ` Michael Ellerman 2019-03-21 10:14 ` Christophe Leroy 2019-03-21 10:14 ` Christophe Leroy 2019-04-21 14:18 ` Michael Ellerman
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87va0c23s8.fsf@concordia.ellerman.id.au \ --to=mpe@ellerman.id.au \ --cc=benh@kernel.crashing.org \ --cc=christophe.leroy@c-s.fr \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=paulus@samba.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.