Skip to content

Commit cb9f6a4

Browse files
committed
irqchip/riscv-imsic: Don't dereference before NULL pointer check
smatch warns about a dereference before check: drivers/irqchip/irq-riscv-imsic-platform.c:317 imsic_irqdomain_init() warn: variable dereferenced before check 'imsic' (see line 311) Cure it by moving the firmware not assignement after the checks. Fixes: 5942290 ("irqchip/riscv-imsic: Convert to msi_create_parent_irq_domain() helper") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ --- drivers/irqchip/irq-riscv-imsic-platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
1 parent 7e161a9 commit cb9f6a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/irqchip/irq-riscv-imsic-platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ static const struct msi_parent_ops imsic_msi_parent_ops = {
308308
int imsic_irqdomain_init(void)
309309
{
310310
struct irq_domain_info info = {
311-
.fwnode = imsic->fwnode,
312311
.ops = &imsic_base_domain_ops,
313312
.host_data = imsic,
314313
};
@@ -325,6 +324,7 @@ int imsic_irqdomain_init(void)
325324
}
326325

327326
/* Create Base IRQ domain */
327+
info.fwnode = imsic->fwnode,
328328
imsic->base_domain = msi_create_parent_irq_domain(&info, &imsic_msi_parent_ops);
329329
if (!imsic->base_domain) {
330330
pr_err("%pfwP: failed to create IMSIC base domain\n", imsic->fwnode);

0 commit comments

Comments
 (0)