[PATCH v4 2/2] phy: qcom-mipi-csi2: Add a CSI2 MIPI DPHY driver

Krzysztof Kozlowski krzk at kernel.org
Mon Mar 16 03:12:00 PDT 2026


On 16/03/2026 00:52, Bryan O'Donoghue wrote:
> +
> +	csi2phy = devm_kzalloc(dev, sizeof(*csi2phy), GFP_KERNEL);
> +	if (!csi2phy)
> +		return -ENOMEM;
> +
> +	csi2phy->dev = dev;
> +	csi2phy->soc_cfg = device_get_match_data(&pdev->dev);
> +
> +	if (!csi2phy->soc_cfg)
> +		return -EINVAL;
> +
> +	num_clk = csi2phy->soc_cfg->num_clk;
> +	csi2phy->clks = devm_kzalloc(dev, sizeof(*csi2phy->clks) * num_clk, GFP_KERNEL);
> +	if (!csi2phy->clks)
> +		return -ENOMEM;
> +
> +	num_pds = csi2phy->soc_cfg->num_genpd_names;
> +	if (!num_pds)
> +		return -EINVAL;
> +
> +	csi2phy->pds = devm_kzalloc(dev, sizeof(*csi2phy->pds) * num_pds, GFP_KERNEL);
> +	if (!csi2phy->pds)
> +		return -ENOMEM;
> +
> +	for (i = 0; i < num_pds; i++) {
> +		csi2phy->pds[i] = dev_pm_domain_attach_by_name(dev,
> +							       csi2phy->soc_cfg->genpd_names[i]);
> +		if (IS_ERR(csi2phy->pds[i])) {

API is terrible, but it does return NULL. Look at other uses of it. Or
read review of sashiko of your patchset.

> +			return dev_err_probe(dev, PTR_ERR(csi2phy->pds[i]),
> +					     "Failed to attach %s\n",
> +					     csi2phy->soc_cfg->genpd_names[i]);
> +		}


Best regards,
Krzysztof



More information about the linux-phy mailing list