We should check if irq_dev is valid before we dereference it by passing
it to dev_get_drvdata.
Change-Id: Ifc0cae729de342f4d2828af7c51b3d0b855b6342
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
static int madera_map_irq(struct madera *madera, int irq)
{
- struct madera_irq_priv *priv = dev_get_drvdata(madera->irq_dev);
+ struct madera_irq_priv *priv;
if (!madera->irq_dev)
return -ENOENT;
+ priv = dev_get_drvdata(madera->irq_dev);
+
return regmap_irq_get_virq(priv->irq_data, irq);
}