[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19587631-3da7-4378-910a-9c3075b96995@kernel.org>
Date: Mon, 22 Jul 2024 14:28:54 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: ysionneau@...rayinc.com, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>
Cc: Jonathan Borne <jborne@...rayinc.com>,
Julian Vetter <jvetter@...rayinc.com>,
Clement Leger <clement@...ment-leger.fr>,
Vincent Chardon <vincent.chardon@...ys-design.com>
Subject: Re: [RFC PATCH v3 19/37] irqchip: Add irq-kvx-apic-gic driver
On 22/07/2024 11:41, ysionneau@...rayinc.com wrote:
> From: Yann Sionneau <ysionneau@...rayinc.com>
>
...
> +
> +static int __init kvx_init_apic_gic(struct device_node *node,
> + struct device_node *parent)
> +{
> + struct kvx_apic_gic *gic;
> + int ret;
> + unsigned int irq;
> +
> + if (!parent) {
> + pr_err("kvx apic gic does not have parent\n");
How is this possible? Aren't you controlling the code being executed?
> + return -EINVAL;
> + }
> +
> + gic = kzalloc(sizeof(*gic), GFP_KERNEL);
> + if (!gic)
> + return -ENOMEM;
> +
> + if (of_property_read_u32(node, "kalray,intc-nr-irqs",
> + &gic->input_nr_irqs))
There is no such property. Also, there shouldn't be anyway...
> + gic->input_nr_irqs = KVX_GIC_INPUT_IT_COUNT;
> +
> + if (WARN_ON(gic->input_nr_irqs > KVX_GIC_INPUT_IT_COUNT)) {
Why? Please, drop all these WARN_ON from here and other patches. WARN_ON
is for cases which cannot happen, as it might panic entire system.
Instead, handle the case properly.
> + ret = -EINVAL;
> + goto err_kfree;
> + }
> +
> + gic->base = of_io_request_and_map(node, 0, node->name);
> + if (!gic->base) {
> + ret = -EINVAL;
> + goto err_kfree;
> + }
> +
> + raw_spin_lock_init(&gic->lock);
> + apic_gic_init(gic);
Best regards,
Krzysztof
Powered by blists - more mailing lists