* [PATCH] tty: serial: ucc_uart: use WARN_ON() instead of BUG()
@ 2025-07-28 1:44 Akhilesh Patil
2025-07-28 4:07 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Akhilesh Patil @ 2025-07-28 1:44 UTC (permalink / raw)
To: gregkh, jirislaby, andriy.shevchenko, john.ogness, pmladek,
johan, namcao, timur
Cc: linux-kernel, linux-serial, linuxppc-dev, akhileshpatilvnit, skhan
Replace BUG() with WARN_ON() as recommended in
Documentation/process/deprecated.rst
Fix system entering into unstable/break/undebuggable state due to use
of BUG(). Follow strict suggestions as per [1] [2].
Link: https://lore.kernel.org/lkml/CA+55aFy6jNLsywVYdGp83AMrXBo_P-pkjkphPGrO=82SPKCpLQ@mail.gmail.com/ [1]
Link: https://lore.kernel.org/lkml/CAHk-=whDHsbK3HTOpTF=ue_o04onRwTEaK_ZoJp_fjbqq4+=Jw@mail.gmail.com/ [2]
Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
---
drivers/tty/serial/ucc_uart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 0613f8c11ab1..6214ab1b67cb 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -223,7 +223,7 @@ static inline dma_addr_t cpu2qe_addr(void *addr, struct uart_qe_port *qe_port)
/* something nasty happened */
printk(KERN_ERR "%s: addr=%p\n", __func__, addr);
- BUG();
+ WARN_ON(1);
return 0;
}
@@ -242,7 +242,7 @@ static inline void *qe2cpu_addr(dma_addr_t addr, struct uart_qe_port *qe_port)
/* something nasty happened */
printk(KERN_ERR "%s: addr=%llx\n", __func__, (u64)addr);
- BUG();
+ WARN_ON(1);
return NULL;
}
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: serial: ucc_uart: use WARN_ON() instead of BUG()
2025-07-28 1:44 [PATCH] tty: serial: ucc_uart: use WARN_ON() instead of BUG() Akhilesh Patil
@ 2025-07-28 4:07 ` Greg KH
2025-07-28 5:31 ` Akhilesh Patil
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2025-07-28 4:07 UTC (permalink / raw)
To: Akhilesh Patil
Cc: jirislaby, andriy.shevchenko, john.ogness, pmladek, johan,
namcao, timur, linux-kernel, linux-serial, linuxppc-dev,
akhileshpatilvnit, skhan
On Mon, Jul 28, 2025 at 07:14:25AM +0530, Akhilesh Patil wrote:
> Replace BUG() with WARN_ON() as recommended in
> Documentation/process/deprecated.rst
> Fix system entering into unstable/break/undebuggable state due to use
> of BUG(). Follow strict suggestions as per [1] [2].
>
> Link: https://lore.kernel.org/lkml/CA+55aFy6jNLsywVYdGp83AMrXBo_P-pkjkphPGrO=82SPKCpLQ@mail.gmail.com/ [1]
> Link: https://lore.kernel.org/lkml/CAHk-=whDHsbK3HTOpTF=ue_o04onRwTEaK_ZoJp_fjbqq4+=Jw@mail.gmail.com/ [2]
> Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
> ---
> drivers/tty/serial/ucc_uart.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
> index 0613f8c11ab1..6214ab1b67cb 100644
> --- a/drivers/tty/serial/ucc_uart.c
> +++ b/drivers/tty/serial/ucc_uart.c
> @@ -223,7 +223,7 @@ static inline dma_addr_t cpu2qe_addr(void *addr, struct uart_qe_port *qe_port)
>
> /* something nasty happened */
> printk(KERN_ERR "%s: addr=%p\n", __func__, addr);
> - BUG();
> + WARN_ON(1);
> return 0;
> }
>
> @@ -242,7 +242,7 @@ static inline void *qe2cpu_addr(dma_addr_t addr, struct uart_qe_port *qe_port)
>
> /* something nasty happened */
> printk(KERN_ERR "%s: addr=%llx\n", __func__, (u64)addr);
> - BUG();
> + WARN_ON(1);
> return NULL;
> }
You can't just do a search/replace for these types of things, otherwise
we would have done so a long time ago.
How did you test this patch? The BUG() here assumes that if this ever
fires, the system is really broken, how have you recovered from that
broken state?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: serial: ucc_uart: use WARN_ON() instead of BUG()
2025-07-28 4:07 ` Greg KH
@ 2025-07-28 5:31 ` Akhilesh Patil
0 siblings, 0 replies; 3+ messages in thread
From: Akhilesh Patil @ 2025-07-28 5:31 UTC (permalink / raw)
To: Greg KH
Cc: jirislaby, andriy.shevchenko, john.ogness, pmladek, johan,
namcao, timur, linux-kernel, linux-serial, linuxppc-dev,
akhileshpatilvnit, skhan
On Mon, Jul 28, 2025 at 06:07:22AM +0200, Greg KH wrote:
> On Mon, Jul 28, 2025 at 07:14:25AM +0530, Akhilesh Patil wrote:
> > Replace BUG() with WARN_ON() as recommended in
> > Documentation/process/deprecated.rst
> > Fix system entering into unstable/break/undebuggable state due to use
> > of BUG(). Follow strict suggestions as per [1] [2].
> >
> > Link: https://lore.kernel.org/lkml/CA+55aFy6jNLsywVYdGp83AMrXBo_P-pkjkphPGrO=82SPKCpLQ@mail.gmail.com/ [1]
> > Link: https://lore.kernel.org/lkml/CAHk-=whDHsbK3HTOpTF=ue_o04onRwTEaK_ZoJp_fjbqq4+=Jw@mail.gmail.com/ [2]
> > Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
> > ---
> > drivers/tty/serial/ucc_uart.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
> > index 0613f8c11ab1..6214ab1b67cb 100644
> > --- a/drivers/tty/serial/ucc_uart.c
> > +++ b/drivers/tty/serial/ucc_uart.c
> > @@ -223,7 +223,7 @@ static inline dma_addr_t cpu2qe_addr(void *addr, struct uart_qe_port *qe_port)
> >
> > /* something nasty happened */
> > printk(KERN_ERR "%s: addr=%p\n", __func__, addr);
> > - BUG();
> > + WARN_ON(1);
> > return 0;
> > }
> >
> > @@ -242,7 +242,7 @@ static inline void *qe2cpu_addr(dma_addr_t addr, struct uart_qe_port *qe_port)
> >
> > /* something nasty happened */
> > printk(KERN_ERR "%s: addr=%llx\n", __func__, (u64)addr);
> > - BUG();
> > + WARN_ON(1);
> > return NULL;
> > }
>
> You can't just do a search/replace for these types of things, otherwise
> we would have done so a long time ago.
>
Hi greg, Agree. Let me dive deep to understand this BUG() -> WARN()
recommendation and come back after detailed analysis for this change.
> How did you test this patch? The BUG() here assumes that if this ever
I have done only build check with NXP p1025rdb configuration as I do not
have this particular hardware handy.
> fires, the system is really broken, how have you recovered from that
> broken state?
>
> thanks,
>
> greg k-h
Thanks for the review :)
Regards,
Akhilesh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-28 5:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-28 1:44 [PATCH] tty: serial: ucc_uart: use WARN_ON() instead of BUG() Akhilesh Patil
2025-07-28 4:07 ` Greg KH
2025-07-28 5:31 ` Akhilesh Patil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®