ASoC: audio-ext-clk: fix number of clocks for lnbb clk

ln_bb_clk2 is defined in a different array than the rest of the
clocks. Use the right array to calculate the number of clocks in
that array to avoid possible over allocation of memory.

Change-Id: I7e68e15d037810840605a7d86dd54eaf6c6cc427
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
diff --git a/sound/soc/codecs/audio-ext-clk-up.c b/sound/soc/codecs/audio-ext-clk-up.c
index 753e7f0..39986d6 100644
--- a/sound/soc/codecs/audio-ext-clk-up.c
+++ b/sound/soc/codecs/audio-ext-clk-up.c
@@ -496,17 +496,18 @@
 	if (!clk_data)
 		goto err_gpio;
 
-	clk_data->clk_num = ARRAY_SIZE(audio_msm_hws);
-	clk_data->clks = devm_kzalloc(&pdev->dev,
-				clk_data->clk_num * sizeof(struct clk *),
-				GFP_KERNEL);
-	if (!clk_data->clks)
-		goto err_clk;
-
 
 	clk_gpio = of_get_named_gpio(pdev->dev.of_node,
 				     "qcom,audio-ref-clk-gpio", 0);
 	if (clk_gpio > 0) {
+		clk_data->clk_num = ARRAY_SIZE(audio_msm_hws);
+		clk_data->clks = devm_kzalloc(&pdev->dev,
+					clk_data->clk_num *
+					sizeof(struct clk *),
+					GFP_KERNEL);
+		if (!clk_data->clks)
+			goto err_clk;
+
 		for (i = 0; i < ARRAY_SIZE(audio_msm_hws); i++) {
 			audio_clk = devm_clk_register(dev, audio_msm_hws[i]);
 			if (IS_ERR(audio_clk)) {
@@ -518,6 +519,14 @@
 			clk_data->clks[i] = audio_clk;
 		}
 	} else {
+		clk_data->clk_num = ARRAY_SIZE(audio_msm_hws1);
+		clk_data->clks = devm_kzalloc(&pdev->dev,
+					clk_data->clk_num *
+					sizeof(struct clk *),
+					GFP_KERNEL);
+		if (!clk_data->clks)
+			goto err_clk;
+
 		for (i = 0; i < ARRAY_SIZE(audio_msm_hws1); i++) {
 			audio_clk = devm_clk_register(dev, audio_msm_hws1[i]);
 			if (IS_ERR(audio_clk)) {