Re: [PATCH net-next v3 3/8] net: qualcomm: ipqess: introduce the Qualcomm IPQESS driver

From: Simon Horman
Date: Wed Nov 15 2023 - 13:11:16 EST


On Tue, Nov 14, 2023 at 11:55:53AM +0100, Romain Gantois wrote:
> The Qualcomm IPQ4019 Ethernet Switch Subsystem for the IPQ4019 chip
> includes an internal Ethernet switch based on the QCA8K IP.
>
> The CPU-to-switch port data plane depends on the IPQESS EDMA Controller,
> a simple 1G Ethernet controller. It is connected to the switch through an
> internal link, and doesn't expose directly any external interface.
>
> The EDMA controller has 16 RX and TX queues, with a very basic RSS fanout
> configured at init time.
>
> Signed-off-by: Romain Gantois <romain.gantois@xxxxxxxxxxx>

Hi Romain,

some minor feedback from my side.

> diff --git a/drivers/net/ethernet/qualcomm/ipqess/ipqess_switch.c b/drivers/net/ethernet/qualcomm/ipqess/ipqess_switch.c

...

> +static int ipqess_switch_probe(struct platform_device *pdev)
> +{

...

> + for_each_available_child_of_node(ports, port_np) {
> + ret = ipqess_port_register(sw, port_np);
> + if (ret) {
> + pr_err("Failed to register ipqess port! error %d\n", ret);

Coccinelle warns that a call to of_node_put() is needed here.

> + goto out_ports;
> + }
> + }

...

> +static int
> +ipqess_switch_remove(struct platform_device *pdev)
> +{
> + struct ipqess_switch *sw = platform_get_drvdata(pdev);
> + struct qca8k_priv *priv = sw->priv;

Here sw is dereferenced...

> + struct ipqess_port *port = NULL;
> + int i;
> +
> + if (!sw)
> + return 0;

... but here the code guards against sw being NULL.
This seems inconsistent.

As flagged by Smatch.

...