summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2019-08-02 13:08:02 +0200
committerPatrice Chotard <patrice.chotard@st.com>2019-08-27 11:19:23 +0200
commit0c8620d2ffe1440165156c7a0d95424c7eabe60b (patch)
treeaeb13d1c4820208adb3451e5dda0f18b80cc099e /drivers/misc
parent8c018234ea712aa9afd7c23905f125f121577c77 (diff)
downloadu-boot-0c8620d2ffe1440165156c7a0d95424c7eabe60b.tar.gz
u-boot-0c8620d2ffe1440165156c7a0d95424c7eabe60b.tar.bz2
u-boot-0c8620d2ffe1440165156c7a0d95424c7eabe60b.zip
bsec: update after MISC u-class update
Since the commit 8729b1ae2cbd ("misc: Update read() and write() methods to return bytes xfered"); The misc bsec driver need to be adapted to reflect the number of transferred bytes. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/stm32mp_fuse.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/misc/stm32mp_fuse.c b/drivers/misc/stm32mp_fuse.c
index 801d946b77..a1a27d148a 100644
--- a/drivers/misc/stm32mp_fuse.c
+++ b/drivers/misc/stm32mp_fuse.c
@@ -20,7 +20,7 @@
*/
int fuse_read(u32 bank, u32 word, u32 *val)
{
- int ret = 0;
+ int ret;
struct udevice *dev;
switch (bank) {
@@ -32,9 +32,10 @@ int fuse_read(u32 bank, u32 word, u32 *val)
return ret;
ret = misc_read(dev, word * 4 + STM32_BSEC_SHADOW_OFFSET,
val, 4);
- if (ret < 0)
- return ret;
- ret = 0;
+ if (ret != 4)
+ ret = -EINVAL;
+ else
+ ret = 0;
break;
#ifdef CONFIG_PMIC_STPMIC1
@@ -67,9 +68,10 @@ int fuse_prog(u32 bank, u32 word, u32 val)
return ret;
ret = misc_write(dev, word * 4 + STM32_BSEC_OTP_OFFSET,
&val, 4);
- if (ret < 0)
- return ret;
- ret = 0;
+ if (ret != 4)
+ ret = -EINVAL;
+ else
+ ret = 0;
break;
#ifdef CONFIG_PMIC_STPMIC1
@@ -100,9 +102,10 @@ int fuse_sense(u32 bank, u32 word, u32 *val)
if (ret)
return ret;
ret = misc_read(dev, word * 4 + STM32_BSEC_OTP_OFFSET, val, 4);
- if (ret < 0)
- return ret;
- ret = 0;
+ if (ret != 4)
+ ret = -EINVAL;
+ else
+ ret = 0;
break;
#ifdef CONFIG_PMIC_STPMIC1
@@ -135,9 +138,10 @@ int fuse_override(u32 bank, u32 word, u32 val)
return ret;
ret = misc_write(dev, word * 4 + STM32_BSEC_SHADOW_OFFSET,
&val, 4);
- if (ret < 0)
- return ret;
- ret = 0;
+ if (ret != 4)
+ ret = -EINVAL;
+ else
+ ret = 0;
break;
#ifdef CONFIG_PMIC_STPMIC1