linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] floppy: check_events callback should not return a negative number
@ 2019-01-29  8:34 Yufen Yu
  2019-01-29  8:41 ` Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yufen Yu @ 2019-01-29  8:34 UTC (permalink / raw)
  To: axboe, dan.carpenter; +Cc: linux-block, kernel-janitors

floppy_check_events() is supposed to return bit flags to say which
events occured. We should return zero to say that no event flags are
set.  Only BIT(0) and BIT(1) are used in the caller. And .check_events
interface also expect to return an unsigned int value.

However, after commit a0c80efe5956, it may return -EINTR (-4u).
Here, both BIT(0) and BIT(1) are cleared. So this patch shouldn't
affect runtime, but it obviously is still worth fixing.

Fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
---
 drivers/block/floppy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 6f2856c6d0f2..55481b40df9a 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
 
 	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
 		if (lock_fdc(drive))
-			return -EINTR;
+			return 0;
 		poll_drive(false, 0);
 		process_fd_request();
 	}
-- 
2.16.2.dirty


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] floppy: check_events callback should not return a negative number
  2019-01-29  8:34 [PATCH v2] floppy: check_events callback should not return a negative number Yufen Yu
@ 2019-01-29  8:41 ` Dan Carpenter
  2019-02-12 10:50 ` yuyufen
  2019-02-12 16:13 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-01-29  8:41 UTC (permalink / raw)
  To: Yufen Yu; +Cc: axboe, linux-block, kernel-janitors

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] floppy: check_events callback should not return a negative number
  2019-01-29  8:34 [PATCH v2] floppy: check_events callback should not return a negative number Yufen Yu
  2019-01-29  8:41 ` Dan Carpenter
@ 2019-02-12 10:50 ` yuyufen
  2019-02-12 16:13 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: yuyufen @ 2019-02-12 10:50 UTC (permalink / raw)
  To: axboe, dan.carpenter; +Cc: linux-block, kernel-janitors

ping?


On 2019/1/29 16:34, Yufen Yu wrote:
> floppy_check_events() is supposed to return bit flags to say which
> events occured. We should return zero to say that no event flags are
> set.  Only BIT(0) and BIT(1) are used in the caller. And .check_events
> interface also expect to return an unsigned int value.
>
> However, after commit a0c80efe5956, it may return -EINTR (-4u).
> Here, both BIT(0) and BIT(1) are cleared. So this patch shouldn't
> affect runtime, but it obviously is still worth fixing.
>
> Fixes: a0c80efe5956 ("floppy: fix lock_fdc() signal handling")
> Signed-off-by: Yufen Yu <yuyufen@huawei.com>
> ---
>   drivers/block/floppy.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> index 6f2856c6d0f2..55481b40df9a 100644
> --- a/drivers/block/floppy.c
> +++ b/drivers/block/floppy.c
> @@ -4075,7 +4075,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
>   
>   	if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
>   		if (lock_fdc(drive))
> -			return -EINTR;
> +			return 0;
>   		poll_drive(false, 0);
>   		process_fd_request();
>   	}



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] floppy: check_events callback should not return a negative number
  2019-01-29  8:34 [PATCH v2] floppy: check_events callback should not return a negative number Yufen Yu
  2019-01-29  8:41 ` Dan Carpenter
  2019-02-12 10:50 ` yuyufen
@ 2019-02-12 16:13 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2019-02-12 16:13 UTC (permalink / raw)
  To: Yufen Yu, dan.carpenter; +Cc: linux-block, kernel-janitors

On 1/29/19 1:34 AM, Yufen Yu wrote:
> floppy_check_events() is supposed to return bit flags to say which
> events occured. We should return zero to say that no event flags are
> set.  Only BIT(0) and BIT(1) are used in the caller. And .check_events
> interface also expect to return an unsigned int value.
> 
> However, after commit a0c80efe5956, it may return -EINTR (-4u).
> Here, both BIT(0) and BIT(1) are cleared. So this patch shouldn't
> affect runtime, but it obviously is still worth fixing.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-12 16:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29  8:34 [PATCH v2] floppy: check_events callback should not return a negative number Yufen Yu
2019-01-29  8:41 ` Dan Carpenter
2019-02-12 10:50 ` yuyufen
2019-02-12 16:13 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).