Commit cb71c5f9 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Daniel Lezcano
Browse files

thermal/drivers/rockchip: Use dev_err_probe



Use dev_err_probe to simplify error printing in the driver's probe
routine.

Reviewed-by: default avatarHeiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230308112253.15659-4-sebastian.reichel@collabora.com
parent 2f6916f1
Loading
Loading
Loading
Loading
+18 −32
Original line number Original line Diff line number Diff line
@@ -1374,35 +1374,26 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
		return PTR_ERR(thermal->regs);
		return PTR_ERR(thermal->regs);


	thermal->reset = devm_reset_control_array_get(&pdev->dev, false, false);
	thermal->reset = devm_reset_control_array_get(&pdev->dev, false, false);
	if (IS_ERR(thermal->reset)) {
	if (IS_ERR(thermal->reset))
		error = PTR_ERR(thermal->reset);
		return dev_err_probe(&pdev->dev, PTR_ERR(thermal->reset),
		dev_err(&pdev->dev, "failed to get tsadc reset: %d\n", error);
				     "failed to get tsadc reset.\n");
		return error;
	}


	thermal->clk = devm_clk_get_enabled(&pdev->dev, "tsadc");
	thermal->clk = devm_clk_get_enabled(&pdev->dev, "tsadc");
	if (IS_ERR(thermal->clk)) {
	if (IS_ERR(thermal->clk))
		error = PTR_ERR(thermal->clk);
		return dev_err_probe(&pdev->dev, PTR_ERR(thermal->clk),
		dev_err(&pdev->dev, "failed to get tsadc clock: %d\n", error);
				     "failed to get tsadc clock.\n");
		return error;
	}


	thermal->pclk = devm_clk_get_enabled(&pdev->dev, "apb_pclk");
	thermal->pclk = devm_clk_get_enabled(&pdev->dev, "apb_pclk");
	if (IS_ERR(thermal->pclk)) {
	if (IS_ERR(thermal->pclk))
		error = PTR_ERR(thermal->pclk);
		return dev_err_probe(&pdev->dev, PTR_ERR(thermal->pclk),
		dev_err(&pdev->dev, "failed to get apb_pclk clock: %d\n",
				     "failed to get apb_pclk clock.\n");
			error);
		return error;
	}


	rockchip_thermal_reset_controller(thermal->reset);
	rockchip_thermal_reset_controller(thermal->reset);


	error = rockchip_configure_from_dt(&pdev->dev, np, thermal);
	error = rockchip_configure_from_dt(&pdev->dev, np, thermal);
	if (error) {
	if (error)
		dev_err(&pdev->dev, "failed to parse device tree data: %d\n",
		return dev_err_probe(&pdev->dev, error,
			error);
				"failed to parse device tree data\n");
		return error;
	}


	thermal->chip->initialize(thermal->grf, thermal->regs,
	thermal->chip->initialize(thermal->grf, thermal->regs,
				  thermal->tshut_polarity);
				  thermal->tshut_polarity);
@@ -1411,23 +1402,18 @@ static int rockchip_thermal_probe(struct platform_device *pdev)
		error = rockchip_thermal_register_sensor(pdev, thermal,
		error = rockchip_thermal_register_sensor(pdev, thermal,
						&thermal->sensors[i],
						&thermal->sensors[i],
						thermal->chip->chn_id[i]);
						thermal->chip->chn_id[i]);
		if (error) {
		if (error)
			dev_err(&pdev->dev,
			return dev_err_probe(&pdev->dev, error,
				"failed to register sensor[%d] : error = %d\n",
				"failed to register sensor[%d].\n", i);
				i, error);
			return error;
		}
	}
	}


	error = devm_request_threaded_irq(&pdev->dev, irq, NULL,
	error = devm_request_threaded_irq(&pdev->dev, irq, NULL,
					  &rockchip_thermal_alarm_irq_thread,
					  &rockchip_thermal_alarm_irq_thread,
					  IRQF_ONESHOT,
					  IRQF_ONESHOT,
					  "rockchip_thermal", thermal);
					  "rockchip_thermal", thermal);
	if (error) {
	if (error)
		dev_err(&pdev->dev,
		return dev_err_probe(&pdev->dev, error,
			"failed to request tsadc irq: %d\n", error);
				     "failed to request tsadc irq.\n");
		return error;
	}


	thermal->chip->control(thermal->regs, true);
	thermal->chip->control(thermal->regs, true);