From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] em28xx-i2c: rt_mutex_trylock() returns zero on failure
Date: Sat, 07 May 2016 13:01:56 +0000 [thread overview]
Message-ID: <20160507100156.30b30487@recife.lan> (raw)
In-Reply-To: <20160311081301.GD31887@mwanda>
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
WARNING: multiple messages have this Message-ID (diff)
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] em28xx-i2c: rt_mutex_trylock() returns zero on failure
Date: Sat, 7 May 2016 10:01:56 -0300 [thread overview]
Message-ID: <20160507100156.30b30487@recife.lan> (raw)
In-Reply-To: <20160311081301.GD31887@mwanda>
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
next prev parent reply other threads:[~2016-05-07 13:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 8:13 [patch] [media] em28xx-i2c: rt_mutex_trylock() returns zero on failure Dan Carpenter
2016-03-11 8:13 ` Dan Carpenter
2016-05-07 13:01 ` Mauro Carvalho Chehab [this message]
2016-05-07 13:01 ` Mauro Carvalho Chehab
2016-05-09 8:22 ` [patch v2][media] " Dan Carpenter
2016-05-09 8:22 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160507100156.30b30487@recife.lan \
--to=mchehab@osg.samsung.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.