Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: mediatek: phy-mtk-hdmi: Simplify with dev_err_probe()

Use the dev_err_probe() helper to simplify error handling during probe.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220328111046.210736-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

AngeloGioacchino Del Regno and committed by
Vinod Koul
f0380843 b7b930f3

+19 -31
+19 -31
drivers/phy/mediatek/phy-mtk-hdmi.c
··· 120 120 return PTR_ERR(hdmi_phy->regs); 121 121 122 122 ref_clk = devm_clk_get(dev, "pll_ref"); 123 - if (IS_ERR(ref_clk)) { 124 - ret = PTR_ERR(ref_clk); 125 - dev_err(&pdev->dev, "Failed to get PLL reference clock: %d\n", 126 - ret); 127 - return ret; 128 - } 123 + if (IS_ERR(ref_clk)) 124 + return dev_err_probe(dev, PTR_ERR(ref_clk), 125 + "Failed to get PLL reference clock\n"); 126 + 129 127 ref_clk_name = __clk_get_name(ref_clk); 130 128 131 129 ret = of_property_read_string(dev->of_node, "clock-output-names", 132 130 &clk_init.name); 133 - if (ret < 0) { 134 - dev_err(dev, "Failed to read clock-output-names: %d\n", ret); 135 - return ret; 136 - } 131 + if (ret < 0) 132 + return dev_err_probe(dev, ret, "Failed to read clock-output-names\n"); 137 133 138 134 hdmi_phy->dev = dev; 139 135 hdmi_phy->conf = ··· 137 141 mtk_hdmi_phy_clk_get_data(hdmi_phy, &clk_init); 138 142 hdmi_phy->pll_hw.init = &clk_init; 139 143 hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw); 140 - if (IS_ERR(hdmi_phy->pll)) { 141 - ret = PTR_ERR(hdmi_phy->pll); 142 - dev_err(dev, "Failed to register PLL: %d\n", ret); 143 - return ret; 144 - } 144 + if (IS_ERR(hdmi_phy->pll)) 145 + return dev_err_probe(dev, PTR_ERR(hdmi_phy->pll), 146 + "Failed to register PLL\n"); 145 147 146 148 ret = of_property_read_u32(dev->of_node, "mediatek,ibias", 147 149 &hdmi_phy->ibias); 148 - if (ret < 0) { 149 - dev_err(&pdev->dev, "Failed to get ibias: %d\n", ret); 150 - return ret; 151 - } 150 + if (ret < 0) 151 + return dev_err_probe(dev, ret, "Failed to get ibias\n"); 152 152 153 153 ret = of_property_read_u32(dev->of_node, "mediatek,ibias_up", 154 154 &hdmi_phy->ibias_up); 155 - if (ret < 0) { 156 - dev_err(&pdev->dev, "Failed to get ibias up: %d\n", ret); 157 - return ret; 158 - } 155 + if (ret < 0) 156 + return dev_err_probe(dev, ret, "Failed to get ibias_up\n"); 159 157 160 158 dev_info(dev, "Using default TX DRV impedance: 4.2k/36\n"); 161 159 hdmi_phy->drv_imp_clk = 0x30; ··· 158 168 hdmi_phy->drv_imp_d0 = 0x30; 159 169 160 170 phy = devm_phy_create(dev, NULL, mtk_hdmi_phy_dev_get_ops(hdmi_phy)); 161 - if (IS_ERR(phy)) { 162 - dev_err(dev, "Failed to create HDMI PHY\n"); 163 - return PTR_ERR(phy); 164 - } 171 + if (IS_ERR(phy)) 172 + return dev_err_probe(dev, PTR_ERR(phy), "Cannot create HDMI PHY\n"); 173 + 165 174 phy_set_drvdata(phy, hdmi_phy); 166 175 167 176 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 168 - if (IS_ERR(phy_provider)) { 169 - dev_err(dev, "Failed to register HDMI PHY\n"); 170 - return PTR_ERR(phy_provider); 171 - } 177 + if (IS_ERR(phy_provider)) 178 + return dev_err_probe(dev, PTR_ERR(phy_provider), 179 + "Failed to register HDMI PHY\n"); 172 180 173 181 if (hdmi_phy->conf->pll_default_off) 174 182 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);