Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1695669

[PATCH 1/3] memory: atmel-ebi: Fix smc timing return value evaluation

From Alexander Dahl <ada@thorsis.com>
Newsgroups linux.kernel
Subject [PATCH 1/3] memory: atmel-ebi: Fix smc timing return value evaluation
Date 2017-07-25 14:10 +0200
Message-ID <u76P2-2BR-49@gated-at.bofh.it> (permalink)
References <u76P0-2BR-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Setting optional EBI/SMC properties through device tree always fails due
to wrong evaluation of the return value of
atmel_ebi_xslate_smc_timings().

If you put some of those properties in your dts file, but not
'atmel,smc-tdf-ns' the local variable 'required' in
atmel_ebi_xslate_smc_timings() stays on 'false' after the first 'if'
block. This leads to setting 'ret' to -EINVAL in the first run of the
following 'for' loop which is then the return value of this function.

However if you set 'atmel,smc-tdf-ns' in the dts file and everything in
atmel_ebi_xslate_smc_timings() works well, it returns the content of
'required' which is 'true' then.

So the function atmel_ebi_xslate_smc_timings() always returns non-zero
which lets its call in atmel_ebi_xslate_smc_config() always fail and
thus returning -EINVAL, so the EBI configuration for this node fails.

Judging from the following code evaluating the local 'required' variable
in atmel_ebi_xslate_smc_config() and the call of caps->xlate_config in
atmel_ebi_dev_setup() it's probably right to only let the call fail if a
negative error code is returned.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 drivers/memory/atmel-ebi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index 99e644c..1cf34d2 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -263,7 +263,7 @@ static int atmel_ebi_xslate_smc_config(struct atmel_ebi_dev *ebid,
 	}
 
 	ret = atmel_ebi_xslate_smc_timings(ebid, np, &conf->smcconf);
-	if (ret)
+	if (ret < 0)
 		return -EINVAL;
 
 	if ((ret > 0 && !required) || (!ret && required)) {
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] memory: atmel-ebi: Fix setting EBI timings through dts Alexander Dahl <ada@thorsis.com> - 2017-07-25 14:10 +0200
  [PATCH 3/3] memory: atmel-ebi: Fix smc cycle xlate converter Alexander Dahl <ada@thorsis.com> - 2017-07-25 14:10 +0200
    Re: [PATCH 3/3] memory: atmel-ebi: Fix smc cycle xlate converter Lee Jones <lee.jones@linaro.org> - 2017-07-26 10:30 +0200
  [PATCH 1/3] memory: atmel-ebi: Fix smc timing return value evaluation Alexander Dahl <ada@thorsis.com> - 2017-07-25 14:10 +0200
  Re: [PATCH 0/3] memory: atmel-ebi: Fix setting EBI timings through  dts Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-07-26 20:30 +0200
  Re: [PATCH 0/3] memory: atmel-ebi: Fix setting EBI timings through  dts Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-26 22:40 +0200

csiph-web