Skip to content

Commit c1e64c0

Browse files
fidomaxLi Yang
authored andcommitted
soc: fsl: qe: fix static checker warning
The patch be7ecbd: "soc: fsl: qe: convert QE interrupt controller to platform_device" from Aug 3, 2021, leads to the following static checker warning: drivers/soc/fsl/qe/qe_ic.c:438 qe_ic_init() warn: unsigned 'qe_ic->virq_low' is never less than zero. In old variant irq_of_parse_and_map() returns zero if failed so unsigned int for virq_high/virq_low was ok. In new variant platform_get_irq() returns negative error codes if failed so we need to use int for virq_high/virq_low. Also simplify high_handler checking and remove the curly braces to make checkpatch happy. Fixes: be7ecbd ("soc: fsl: qe: convert QE interrupt controller to platform_device") Signed-off-by: Maxim Kochetkov <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Li Yang <[email protected]>
1 parent be7ecbd commit c1e64c0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/soc/fsl/qe/qe_ic.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ struct qe_ic {
5454
struct irq_chip hc_irq;
5555

5656
/* VIRQ numbers of QE high/low irqs */
57-
unsigned int virq_high;
58-
unsigned int virq_low;
57+
int virq_high;
58+
int virq_low;
5959
};
6060

6161
/*
@@ -435,11 +435,10 @@ static int qe_ic_init(struct platform_device *pdev)
435435
qe_ic->virq_high = platform_get_irq(pdev, 0);
436436
qe_ic->virq_low = platform_get_irq(pdev, 1);
437437

438-
if (qe_ic->virq_low < 0) {
438+
if (qe_ic->virq_low <= 0)
439439
return -ENODEV;
440-
}
441440

442-
if (qe_ic->virq_high != qe_ic->virq_low) {
441+
if (qe_ic->virq_high > 0 && qe_ic->virq_high != qe_ic->virq_low) {
443442
low_handler = qe_ic_cascade_low;
444443
high_handler = qe_ic_cascade_high;
445444
} else {
@@ -459,7 +458,7 @@ static int qe_ic_init(struct platform_device *pdev)
459458
irq_set_handler_data(qe_ic->virq_low, qe_ic);
460459
irq_set_chained_handler(qe_ic->virq_low, low_handler);
461460

462-
if (qe_ic->virq_high && qe_ic->virq_high != qe_ic->virq_low) {
461+
if (high_handler) {
463462
irq_set_handler_data(qe_ic->virq_high, qe_ic);
464463
irq_set_chained_handler(qe_ic->virq_high, high_handler);
465464
}

0 commit comments

Comments
 (0)