Skip to content

Commit 1decef3

Browse files
committed
gnss: sirf: fix synchronous write timeout
Passing a timeout of zero to the synchronous serdev_device_write() helper does currently not imply to wait forever (unlike passing zero to serdev_device_wait_until_sent()). Instead, if there's insufficient room in the write buffer, we'd end up with an incomplete write. Fixes: d2efbbd ("gnss: add driver for sirfstar-based receivers") Cc: stable <stable@vger.kernel.org> # 4.19 Signed-off-by: Johan Hovold <johan@kernel.org>
1 parent 56a6c72 commit 1decef3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/gnss/sirf.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/pm.h>
1717
#include <linux/pm_runtime.h>
1818
#include <linux/regulator/consumer.h>
19+
#include <linux/sched.h>
1920
#include <linux/serdev.h>
2021
#include <linux/slab.h>
2122
#include <linux/wait.h>
@@ -83,7 +84,7 @@ static int sirf_write_raw(struct gnss_device *gdev, const unsigned char *buf,
8384
int ret;
8485

8586
/* write is only buffered synchronously */
86-
ret = serdev_device_write(serdev, buf, count, 0);
87+
ret = serdev_device_write(serdev, buf, count, MAX_SCHEDULE_TIMEOUT);
8788
if (ret < 0)
8889
return ret;
8990

0 commit comments

Comments
 (0)