Commit 8d64fc50 authored by Laurentiu-Cristian Duca's avatar Laurentiu-Cristian Duca Committed by Jan Kiszka

spi: fix read() return code checking in spi_master_read_rt()

spi-master.c: spi_master_read_rt(): when master->ops->read()
completes successfully it returns > 0, so, in this case,
copy data to userspace.
Signed-off-by: default avatarLaurentiu-Cristian Duca <laurentiu.duca@gmail.com>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 7fc4489a
...@@ -240,8 +240,8 @@ static ssize_t spi_master_read_rt(struct rtdm_fd *fd, ...@@ -240,8 +240,8 @@ static ssize_t spi_master_read_rt(struct rtdm_fd *fd,
do_chip_deselect(slave); do_chip_deselect(slave);
} }
rtdm_mutex_unlock(&master->bus_lock); rtdm_mutex_unlock(&master->bus_lock);
if (ret == 0) if (ret > 0)
ret = rtdm_safe_copy_to_user(fd, u_buf, rx, len); ret = rtdm_safe_copy_to_user(fd, u_buf, rx, ret);
xnfree(rx); xnfree(rx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment