diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c
index 6cb4aa28ef652480f2db338a80f9ff7818f81abe..6d1d19eeb2e930305788efd48edca55cce754966 100644
--- a/sound/soc/codecs/ak4458.c
+++ b/sound/soc/codecs/ak4458.c
@@ -656,14 +656,14 @@ static int ak4458_hw_params(struct snd_pcm_substream *substream,
 	int ret, dsd_bclk, channels, channels_max;
 	bool is_dsd = false;
 
-	channels = params_channels(params);
-	channels_max = dai->driver->playback.channels_max;
-
 #ifdef AK4458_ACKS_USE_MANUAL_MODE
 	u8 dfs1, dfs2;
 #endif
 	int nfs1;
 
+	channels = params_channels(params);
+	channels_max = dai->driver->playback.channels_max;
+
 	dev_dbg(dai->dev, "%s(%d)\n", __func__, __LINE__);
 
 	switch (params_format(params)) {