Re: [RFC PATCH 2/3] media: platform: Add CRU driver for RZ/G2L SoC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2021-12-07 at 01:23 +0000, Lad Prabhakar wrote:
[...]
> +static int rzg2l_cru_probe(struct platform_device *pdev)
> +{
> +	struct rzg2l_cru_dev *cru;
> +	struct v4l2_ctrl *ctrl;
> +	int irq, ret;
> +
> +	cru = devm_kzalloc(&pdev->dev, sizeof(*cru), GFP_KERNEL);
> +	if (!cru)
> +		return -ENOMEM;
> +
> +	cru->dev = &pdev->dev;
> +	cru->info = of_device_get_match_data(&pdev->dev);
> +
> +	cru->base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(cru->base))
> +		return PTR_ERR(cru->base);
> +
> +	irq = platform_get_irq(pdev, 1);
> +	if (irq < 0)
> +		return irq;
> +
> +	cru->vclk = clk_get(&pdev->dev, "vclk");
> +	if (IS_ERR(cru->vclk))
> +		return PTR_ERR(cru->vclk);

devm_clk_get()?
Don't mix devm and non-devm functions like this, all devm functions
should be placed first.

> +	cru->cmn_restb = devm_reset_control_get_by_index(&pdev->dev, 0);

Your binding has reset-names defined, please request reset controls by
name. Use devm_reset_control_get_explicit() instead, same below.

> +	if (IS_ERR(cru->cmn_restb)) {
> +		dev_err(&pdev->dev, "failed to get cpg cmn_restb\n");
> +		return PTR_ERR(cru->cmn_restb);

These could return -EPROBE_DEFER, I suggest to

		return dev_err_probe(&pdev->dev, PTR_ERR(cru->cmn_restb),
				     "failed to get cpg cmn_restb\n");

instead, same below.

> +	}
> +	cru->presetn = devm_reset_control_get_by_index(&pdev->dev, 1);
> +	if (IS_ERR(cru->presetn)) {
> +		dev_err(&pdev->dev, "failed to get cpg presetn\n");
> +		return PTR_ERR(cru->presetn);
> +	}
> +	cru->aresetn = devm_reset_control_get_by_index(&pdev->dev, 2);
> +	if (IS_ERR(cru->aresetn)) {
> +		dev_err(&pdev->dev, "failed to get cpg aresetn\n");
> +		return PTR_ERR(cru->aresetn);
> +	}

regards
Philipp



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux