Subject: Re: [PATCH 12/17] irqchip: Add support for LAN966x OIC

From: Herve Codina <[email-masked]>
Date: Thu, 2 May 2024 15:24:09 +0200

Hi Simon,

On Tue, 30 Apr 2024 21:24:51 +0100
Simon Horman <[email-masked]> wrote:

> On Tue, Apr 30, 2024 at 10:37:21AM +0200, Herve Codina wrote:
> > The Microchip LAN966x outband interrupt controller (OIC) maps the
> > internal interrupt sources of the LAN966x device to an external
> > interrupt.
> > When the LAN966x device is used as a PCI device, the external interrupt
> > is routed to the PCI interrupt.
> > 
> > Signed-off-by: Herve Codina <[email-masked]>  
> 
> Hi Herve,
> 
> > +static int lan966x_oic_probe(struct platform_device *pdev)
> > +{
> > +	struct device_node *node = pdev->dev.of_node;
> > +	struct lan966x_oic_data *lan966x_oic;
> > +	struct device *dev = &pdev->dev;
> > +	struct irq_chip_generic *gc;
> > +	int ret;
> > +	int i;
> > +
> > +	lan966x_oic = devm_kmalloc(dev, sizeof(*lan966x_oic), GFP_KERNEL);
> > +	if (!lan966x_oic)
> > +		return -ENOMEM;
> > +
> > +	lan966x_oic->regs = devm_platform_ioremap_resource(pdev, 0);
> > +	if (IS_ERR(lan966x_oic->regs))
> > +		return dev_err_probe(dev, PTR_ERR(lan966x_oic->regs),
> > +				     "failed to map resource\n");
> > +
> > +	lan966x_oic->domain = irq_domain_alloc_linear(of_node_to_fwnode(node),
> > +						      LAN966X_OIC_NR_IRQ,
> > +						      &irq_generic_chip_ops, NULL);  
> 
> nit: Please consider limiting lines to 80 columns wide in Networking code.

This will be done in the next iteration.

> 
> > +	if (!lan966x_oic->domain) {
> > +		dev_err(dev, "failed to create an IRQ domain\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	lan966x_oic->irq = platform_get_irq(pdev, 0);
> > +	if (lan966x_oic->irq < 0) {
> > +		dev_err_probe(dev, lan966x_oic->irq, "failed to get the IRQ\n");
> > +		goto err_domain_free;  
> 
> Hi,
> 
> This will result in the function returning ret.
> However, ret is uninitialised here.
> 
> Flagged by W=1 builds with clang-18, and Smatch.

Indeed, this fill be fixed in the next iteration.

Best regards,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com