bsec: update after MISC u-class update
Since the commit 8729b1ae2c ("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>
This commit is contained in:
committed by
Patrice Chotard
parent
8c018234ea
commit
0c8620d2ff
@@ -364,15 +364,13 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset,
|
||||
offs -= STM32_BSEC_OTP_OFFSET;
|
||||
shadow = false;
|
||||
}
|
||||
|
||||
if (offs < 0 || (offs % 4) || (size % 4))
|
||||
return -EINVAL;
|
||||
|
||||
otp = offs / sizeof(u32);
|
||||
|
||||
if (otp < 0 || (otp + nb_otp - 1) > BSEC_OTP_MAX_VALUE) {
|
||||
dev_err(dev, "wrong value for otp, max value : %i\n",
|
||||
BSEC_OTP_MAX_VALUE);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = otp; i < (otp + nb_otp); i++) {
|
||||
for (i = otp; i < (otp + nb_otp) && i <= BSEC_OTP_MAX_VALUE; i++) {
|
||||
u32 *addr = &((u32 *)buf)[i - otp];
|
||||
|
||||
if (shadow)
|
||||
@@ -383,7 +381,10 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset,
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
if (ret)
|
||||
return ret;
|
||||
else
|
||||
return (i - otp) * 4;
|
||||
}
|
||||
|
||||
static int stm32mp_bsec_write(struct udevice *dev, int offset,
|
||||
@@ -400,15 +401,13 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset,
|
||||
offs -= STM32_BSEC_OTP_OFFSET;
|
||||
shadow = false;
|
||||
}
|
||||
|
||||
if (offs < 0 || (offs % 4) || (size % 4))
|
||||
return -EINVAL;
|
||||
|
||||
otp = offs / sizeof(u32);
|
||||
|
||||
if (otp < 0 || (otp + nb_otp - 1) > BSEC_OTP_MAX_VALUE) {
|
||||
dev_err(dev, "wrong value for otp, max value : %d\n",
|
||||
BSEC_OTP_MAX_VALUE);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = otp; i < otp + nb_otp; i++) {
|
||||
for (i = otp; i < otp + nb_otp && i <= BSEC_OTP_MAX_VALUE; i++) {
|
||||
u32 *val = &((u32 *)buf)[i - otp];
|
||||
|
||||
if (shadow)
|
||||
@@ -418,7 +417,10 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset,
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
if (ret)
|
||||
return ret;
|
||||
else
|
||||
return (i - otp) * 4;
|
||||
}
|
||||
|
||||
static const struct misc_ops stm32mp_bsec_ops = {
|
||||
|
||||
Reference in New Issue
Block a user