Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1396307 > unrolled thread
| Started by | Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
|---|---|
| First post | 2016-05-07 15:10 +0200 |
| Last post | 2016-05-09 10:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [patch] [media] em28xx-i2c: rt_mutex_trylock() returns zero on failure Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-05-07 15:10 +0200
[patch v2][media] em28xx-i2c: rt_mutex_trylock() returns zero on failure Dan Carpenter <dan.carpenter@oracle.com> - 2016-05-09 10:30 +0200
| From | Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
|---|---|
| Date | 2016-05-07 15:10 +0200 |
| Subject | Re: [patch] [media] em28xx-i2c: rt_mutex_trylock() returns zero on failure |
| Message-ID | <rwa9A-25i-7@gated-at.bofh.it> |
Em Fri, 11 Mar 2016 11:13:01 +0300
Dan Carpenter <dan.carpenter@oracle.com> escreveu:
> The code is checking for negative returns but it should be checking for
> zero.
>
> Fixes: aab3125c43d8 ('[media] em28xx: add support for registering multiple i2c buses')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Is -EBUSY correct? -EAGAIN?
I guess -EAGAIN would be better.
Regards,
Mauro
>
> diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
> index a19b5c8..f80dd3a 100644
> --- a/drivers/media/usb/em28xx/em28xx-i2c.c
> +++ b/drivers/media/usb/em28xx/em28xx-i2c.c
> @@ -507,9 +507,8 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
> if (dev->disconnected)
> return -ENODEV;
>
> - rc = rt_mutex_trylock(&dev->i2c_bus_lock);
> - if (rc < 0)
> - return rc;
> + if (!rt_mutex_trylock(&dev->i2c_bus_lock))
> + return -EBUSY;
>
> /* Switch I2C bus if needed */
> if (bus != dev->cur_i2c_bus &&
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Thanks,
Mauro
[toc] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2016-05-09 10:30 +0200 |
| Subject | [patch v2][media] em28xx-i2c: rt_mutex_trylock() returns zero on failure |
| Message-ID | <rwOJI-1qn-21@gated-at.bofh.it> |
| In reply to | #1396307 |
The code is checking for negative returns but it should be checking for
zero.
Fixes: aab3125c43d8 ('[media] em28xx: add support for registering multiple i2c buses')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Use different error code.
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index a19b5c8..1a9e1e5 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -507,9 +507,8 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
if (dev->disconnected)
return -ENODEV;
- rc = rt_mutex_trylock(&dev->i2c_bus_lock);
- if (rc < 0)
- return rc;
+ if (!rt_mutex_trylock(&dev->i2c_bus_lock))
+ return -EAGAIN;
/* Switch I2C bus if needed */
if (bus != dev->cur_i2c_bus &&
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web