Skip to content

Commit

Permalink
ARM: s3c: irq-s3c24xx: Fix return value check for s3c24xx_init_intc()
Browse files Browse the repository at this point in the history
The s3c24xx_init_intc() returns an error pointer upon failure, not NULL.
let's add an error pointer check in s3c24xx_handle_irq.

s3c_intc[0] is not NULL or ERR, we can simplify the code.

Fixes: 1f629b7 ("ARM: S3C24XX: transform irq handling into a declarative form")
Signed-off-by: Jackie Liu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
  • Loading branch information
JackieLiu1 authored and krzk committed Sep 15, 2021
1 parent 6880fa6 commit 2aa7174
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions arch/arm/mach-s3c/irq-s3c24xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,25 @@ static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc,
static asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs)
{
do {
if (likely(s3c_intc[0]))
if (s3c24xx_handle_intc(s3c_intc[0], regs, 0))
continue;
/*
* For platform based machines, neither ERR nor NULL can happen here.
* The s3c24xx_handle_irq() will be set as IRQ handler iff this succeeds:
*
* s3c_intc[0] = s3c24xx_init_intc()
*
* If this fails, the next calls to s3c24xx_init_intc() won't be executed.
*
* For DT machine, s3c_init_intc_of() could set the IRQ handler without
* setting s3c_intc[0] only if it was called with num_ctrl=0. There is no
* such code path, so again the s3c_intc[0] will have a valid pointer if
* set_handle_irq() is called.
*
* Therefore in s3c24xx_handle_irq(), the s3c_intc[0] is always something.
*/
if (s3c24xx_handle_intc(s3c_intc[0], regs, 0))
continue;

if (s3c_intc[2])
if (!IS_ERR_OR_NULL(s3c_intc[2]))
if (s3c24xx_handle_intc(s3c_intc[2], regs, 64))
continue;

Expand Down

0 comments on commit 2aa7174

Please sign in to comment.