armbian / linux-rockchip

Improved Rockchip Linux
Other
99 stars 142 forks source link

Suggestion to Optimize clk_put Usage in `rk628_csi_probe_of` #204

Closed msmarks closed 1 week ago

msmarks commented 1 week ago

In the rk628_csi_probe_of function, the clk_put label is currently used to disable and unprepare the soc_24M clock regardless of whether an error occurs earlier in the function. However, it seems that this might not be necessary and could be optimized. Specifically, the clk_put section may only need to be executed when an error occurs, rather than on every exit of the function.

https://github.com/armbian/linux-rockchip/blob/75ac2784c40818adbdabb06e98ac18317af5fdac/drivers/media/i2c/rk628/rk628_csi_v4l2.c#L2150-L2166

maybe just return on line 2175 ?

amazingfate commented 1 week ago

Please check if rkr3 has fixed it.

amazingfate commented 1 week ago

https://github.com/armbian/linux-rockchip/blob/rk-6.1-rkr3/drivers%2Fmedia%2Fi2c%2Frk628%2Frk628_csi_v4l2.c

msmarks commented 1 week ago

It was fixed on branch rkr3, thanks.