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

media: meson: vdec_1: Refactor vdec_1_stop()

Factor out all the power off logic, except the clk_disable_unprepare(),
to a new function __vdec_1_stop().

This allows vdec_1_start() to explicitly clean-out the clock during the
error-path.

The following smatch warning is fixed:
drivers/staging/media/meson/vdec/vdec_1.c:239 vdec_1_start() warn: 'core->vdec_1_clk' from clk_prepare_enable() not released on lines: 239.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Ricardo Ribalda and committed by
Hans Verkuil
bc24a85d 157c7368

+12 -4
+12 -4
drivers/staging/media/meson/vdec/vdec_1.c
··· 129 129 return amvdec_read_dos(core, VLD_MEM_VIFIFO_LEVEL); 130 130 } 131 131 132 - static int vdec_1_stop(struct amvdec_session *sess) 132 + static void __vdec_1_stop(struct amvdec_session *sess) 133 133 { 134 134 struct amvdec_core *core = sess->core; 135 135 struct amvdec_codec_ops *codec_ops = sess->fmt_out->codec_ops; ··· 158 158 regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, 159 159 GEN_PWR_VDEC_1, GEN_PWR_VDEC_1); 160 160 161 - clk_disable_unprepare(core->vdec_1_clk); 162 - 163 161 if (sess->priv) 164 162 codec_ops->stop(sess); 163 + } 164 + 165 + static int vdec_1_stop(struct amvdec_session *sess) 166 + { 167 + struct amvdec_core *core = sess->core; 168 + 169 + __vdec_1_stop(sess); 170 + 171 + clk_disable_unprepare(core->vdec_1_clk); 165 172 166 173 return 0; 167 174 } ··· 242 235 return 0; 243 236 244 237 stop: 245 - vdec_1_stop(sess); 238 + __vdec_1_stop(sess); 239 + clk_disable_unprepare(core->vdec_1_clk); 246 240 return ret; 247 241 } 248 242