]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
memory: omap-gpmc: return meaningful error codes in gpmc_cs_set_timings()
authorKrzysztof Kozlowski <krzk@kernel.org>
Fri, 24 Jul 2020 07:40:29 +0000 (09:40 +0200)
committerKrzysztof Kozlowski <krzk@kernel.org>
Mon, 17 Aug 2020 18:43:35 +0000 (20:43 +0200)
The callers of gpmc_cs_set_timings() expect to receive -ERRNO on errors
and they pass further what they have received.

However gpmc_cs_set_timings() was returning -1 (equal to -EPERM) which
does not make sense in this context.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20200724074038.5597-21-krzk@kernel.org
drivers/memory/omap-gpmc.c

index 324870d51dbc1de64b1a5a2d9736849e0b440ebc..792cdf048881b2d1808b2d4da65e73eeaaaa2373 100644 (file)
@@ -635,7 +635,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, int max
 #define GPMC_SET_ONE_CD_MAX(reg, st, end, max, field, cd)  \
        if (set_gpmc_timing_reg(cs, (reg), (st), (end), (max), \
            t->field, (cd), #field) < 0)                       \
-               return -1
+               return -ENXIO
 
 #define GPMC_SET_ONE(reg, st, end, field) \
        GPMC_SET_ONE_CD_MAX(reg, st, end, 0, field, GPMC_CD_FCLK)
@@ -703,7 +703,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
 
        div = gpmc_calc_divider(t->sync_clk);
        if (div < 0)
-               return div;
+               return -EINVAL;
 
        /*
         * See if we need to change the divider for waitmonitoringtime.
@@ -727,7 +727,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t,
                               __func__,
                               t->wait_monitoring
                               );
-                       return -1;
+                       return -ENXIO;
                }
        }