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

drm/rockchip: cdn-dp: return error code when clk_get_rate failed

The clk_get_rate return 0 if something goes wrong, so it can never be
less then zero, the ret should be set a error code, otherwise the
cdn_dp_clk_enable will return 0 when it failed at clk_get_rate.
In addition, clk_get_rate() returns an "unsigned long", so use
"unsigned long" instead of "u32" is better.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1488940077-22297-2-git-send-email-zyw@rock-chips.com

authored by

Chris Zhong and committed by
Sean Paul
a68b5bb6 a4521654

+5 -4
+3 -2
drivers/gpu/drm/rockchip/cdn-dp-core.c
··· 94 94 static int cdn_dp_clk_enable(struct cdn_dp_device *dp) 95 95 { 96 96 int ret; 97 - u32 rate; 97 + unsigned long rate; 98 98 99 99 ret = clk_prepare_enable(dp->pclk); 100 100 if (ret < 0) { ··· 123 123 124 124 rate = clk_get_rate(dp->core_clk); 125 125 if (!rate) { 126 - DRM_DEV_ERROR(dp->dev, "get clk rate failed: %d\n", rate); 126 + DRM_DEV_ERROR(dp->dev, "get clk rate failed\n"); 127 + ret = -EINVAL; 127 128 goto err_set_rate; 128 129 } 129 130
+1 -1
drivers/gpu/drm/rockchip/cdn-dp-reg.c
··· 29 29 #define LINK_TRAINING_RETRY_MS 20 30 30 #define LINK_TRAINING_TIMEOUT_MS 500 31 31 32 - void cdn_dp_set_fw_clk(struct cdn_dp_device *dp, u32 clk) 32 + void cdn_dp_set_fw_clk(struct cdn_dp_device *dp, unsigned long clk) 33 33 { 34 34 writel(clk / 1000000, dp->regs + SW_CLK_H); 35 35 }
+1 -1
drivers/gpu/drm/rockchip/cdn-dp-reg.h
··· 462 462 463 463 void cdn_dp_clock_reset(struct cdn_dp_device *dp); 464 464 465 - void cdn_dp_set_fw_clk(struct cdn_dp_device *dp, u32 clk); 465 + void cdn_dp_set_fw_clk(struct cdn_dp_device *dp, unsigned long clk); 466 466 int cdn_dp_load_firmware(struct cdn_dp_device *dp, const u32 *i_mem, 467 467 u32 i_size, const u32 *d_mem, u32 d_size); 468 468 int cdn_dp_set_firmware_active(struct cdn_dp_device *dp, bool enable);