lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <939b96b8727054729207211f25ff91ccf8328e28.camel@pengutronix.de>
Date:   Mon, 27 Nov 2023 14:17:15 +0100
From:   Philipp Zabel <p.zabel@...gutronix.de>
To:     Shengyang Chen <shengyang.chen@...rfivetech.com>,
        devicetree@...r.kernel.org, linux-phy@...ts.infradead.org
Cc:     vkoul@...nel.org, kishon@...nel.org, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
        minda.chen@...rfivetech.com, changhuang.liang@...rfivetech.com,
        rogerq@...nel.org, geert+renesas@...der.be,
        keith.zhao@...rfivetech.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/2] phy: starfive: Add mipi dphy tx support

On Fr, 2023-11-17 at 21:04 +0800, Shengyang Chen wrote:
> Add mipi dphy tx support for the StarFive JH7110 SoC.
> It is used to transfer DSI data.
> 
> Signed-off-by: Shengyang Chen <shengyang.chen@...rfivetech.com>
> ---
[...]
> diff --git a/drivers/phy/starfive/phy-jh7110-dphy-tx.c b/drivers/phy/starfive/phy-jh7110-dphy-tx.c
> new file mode 100644
> index 000000000000..69aa172563e4
> --- /dev/null
> +++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c
> @@ -0,0 +1,542 @@
[...]
> +static int stf_dphy_probe(struct platform_device *pdev)
> +{
[...]
> +	dphy->topsys = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(dphy->topsys)) {
> +		ret = PTR_ERR(dphy->topsys);
> +		return ret;

This could be shortened to:

		return PTR_ERR(dphy->topsys);

> +	}
> +
> +	pm_runtime_enable(&pdev->dev);
> +
> +	dphy->mipitx_0p9 = devm_regulator_get(&pdev->dev, "mipi_0p9");
> +	if (IS_ERR(dphy->mipitx_0p9)) {
> +		ret = PTR_ERR(dphy->mipitx_0p9);
> +		return ret;

Same as above.

> +	}
> +
> +	dphy->txesc_clk = devm_clk_get(&pdev->dev, "dphy_txesc");
> +	if (IS_ERR(dphy->txesc_clk)) {
> +		ret = PTR_ERR(dphy->txesc_clk);
> +		dev_err(&pdev->dev, "txesc_clk get error\n");
> +		return ret;

Consider using dev_err_probe():

		return dev_err_probe(&pdev->dev, PTR_ERR(dphy->txesc_clk),
				     "txesc_clk get error\n");

And the same for the error paths below.

> +	}
> +
> +	dphy->sys_rst = reset_control_get_exclusive(&pdev->dev, "dphy_sys");

Why not devm_reset_control_get_exclusive()?

> +	if (IS_ERR(dphy->sys_rst)) {
> +		ret = PTR_ERR(dphy->sys_rst);
> +		dev_err(&pdev->dev, "sys_rst get error\n");
> +		return ret;
> +	}
> +
> +	dphy->txbytehs_rst = reset_control_get_exclusive(&pdev->dev, "dsi_txbytehs");

Same as above.

> +	if (IS_ERR(dphy->txbytehs_rst)) {
> +		dev_err(&pdev->dev, "Failed to get txbytehs_rst\n");
> +		return PTR_ERR(dphy->txbytehs_rst);
> +	}
> +
> +	dphy->phy = devm_phy_create(&pdev->dev, NULL, &stf_dphy_ops);
> +	if (IS_ERR(dphy->phy)) {
> +		ret = PTR_ERR(dphy->phy);
> +		dev_err(&pdev->dev, "Failed to create phy\n");
> +		return ret;
> +	}
> +	phy_set_drvdata(dphy->phy, dphy);
> +
> +	phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
> +	if (IS_ERR(phy_provider)) {
> +		ret = PTR_ERR(phy_provider);
> +		dev_err(&pdev->dev, "Failed to create phy\n");
> +		return ret;
> +	}
> +
> +	return PTR_ERR_OR_ZERO(phy_provider);

This can not be reached in the error case, so just:

	return 0;

should suffice.


regards
Philipp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ