irqchip/irq-mvebu-icu: Fix works by chance pointer assignment
authorThomas Gleixner <tglx@linutronix.de>
Mon, 21 Nov 2022 14:39:29 +0000 (15:39 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 6 Dec 2022 11:50:17 +0000 (12:50 +0100)
Assigning a void pointer which points to a struct to two different data
types only works by chance if the second type is the first member of the
struct.

Replace this works by chance code by using the primary struct pointer.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221121140048.344525618@linutronix.de
drivers/irqchip/irq-mvebu-icu.c

index 497da344717cf2c6c57f4bbc01e934da3e675c47..3c77acc7ec6a5f3a467161ee1862ce33b9d74a83 100644 (file)
@@ -151,9 +151,9 @@ static int
 mvebu_icu_irq_domain_translate(struct irq_domain *d, struct irq_fwspec *fwspec,
                               unsigned long *hwirq, unsigned int *type)
 {
-       struct mvebu_icu_msi_data *msi_data = platform_msi_get_host_data(d);
-       struct mvebu_icu *icu = platform_msi_get_host_data(d);
        unsigned int param_count = static_branch_unlikely(&legacy_bindings) ? 3 : 2;
+       struct mvebu_icu_msi_data *msi_data = platform_msi_get_host_data(d);
+       struct mvebu_icu *icu = msi_data->icu;
 
        /* Check the count of the parameters in dt */
        if (WARN_ON(fwspec->param_count != param_count)) {