mmc: arasan: Fix the issue in reading tap values from DT
authorSai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Tue, 15 Jun 2021 10:43:57 +0000 (16:13 +0530)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 24 Aug 2021 08:15:29 +0000 (10:15 +0200)
'of_property_read_variable_u32_array' function returns number
of elements read on success. This patch updates the condition
check in the driver to overwrite the tap values from DT if exist.

Signed-off-by: Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/1623753837-21035-8-git-send-email-manish.narani@xilinx.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-of-arasan.c

index ba425b9..737e2bf 100644 (file)
@@ -1019,13 +1019,15 @@ static void arasan_dt_read_clk_phase(struct device *dev,
        struct device_node *np = dev->of_node;
 
        u32 clk_phase[2] = {0};
+       int ret;
 
        /*
         * Read Tap Delay values from DT, if the DT does not contain the
         * Tap Values then use the pre-defined values.
         */
-       if (of_property_read_variable_u32_array(np, prop, &clk_phase[0],
-                                               2, 0)) {
+       ret = of_property_read_variable_u32_array(np, prop, &clk_phase[0],
+                                                 2, 0);
+       if (ret < 0) {
                dev_dbg(dev, "Using predefined clock phase for %s = %d %d\n",
                        prop, clk_data->clk_phase_in[timing],
                        clk_data->clk_phase_out[timing]);