diff mbox series

media: uvcvideo: fix return value check in uvc_gpio_parse()

Message ID 20221024134932.2873081-1-yangyingliang@huawei.com
State New
Headers show
Series media: uvcvideo: fix return value check in uvc_gpio_parse() | expand

Commit Message

Yang Yingliang Oct. 24, 2022, 1:49 p.m. UTC
gpiod_to_irq() may return -EPROBE_DEFER, add a minus sign to fix it.

Fixes: 2886477ff987 ("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/media/usb/uvc/uvc_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ricardo Ribalda Oct. 24, 2022, 6:03 p.m. UTC | #1
Hi Yang

Good catch, luckily the only effect is whether the error message is
printed or not. But it has to be fixed.

On Mon, 24 Oct 2022 at 15:50, Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> gpiod_to_irq() may return -EPROBE_DEFER, add a minus sign to fix it.
>
> Fixes: 2886477ff987 ("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT")
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 215fb483efb0..1e6bdd6104ef 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1267,7 +1267,7 @@ static int uvc_gpio_parse(struct uvc_device *dev)
>
>         irq = gpiod_to_irq(gpio_privacy);
>         if (irq < 0) {
> -               if (irq != EPROBE_DEFER)
> +               if (irq != -EPROBE_DEFER)
>                         dev_err(&dev->udev->dev,
>                                 "No IRQ for privacy GPIO (%d)\n", irq);
>                 return irq;
> --
> 2.25.1
>
Laurent Pinchart Oct. 24, 2022, 6:10 p.m. UTC | #2
Hi Yang,

Thank you for the patch.

On Mon, Oct 24, 2022 at 09:49:32PM +0800, Yang Yingliang wrote:
> gpiod_to_irq() may return -EPROBE_DEFER, add a minus sign to fix it.
> 
> Fixes: 2886477ff987 ("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 215fb483efb0..1e6bdd6104ef 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1267,7 +1267,7 @@ static int uvc_gpio_parse(struct uvc_device *dev)
>  
>  	irq = gpiod_to_irq(gpio_privacy);
>  	if (irq < 0) {
> -		if (irq != EPROBE_DEFER)
> +		if (irq != -EPROBE_DEFER)

Oops.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  			dev_err(&dev->udev->dev,
>  				"No IRQ for privacy GPIO (%d)\n", irq);
>  		return irq;
diff mbox series

Patch

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 215fb483efb0..1e6bdd6104ef 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1267,7 +1267,7 @@  static int uvc_gpio_parse(struct uvc_device *dev)
 
 	irq = gpiod_to_irq(gpio_privacy);
 	if (irq < 0) {
-		if (irq != EPROBE_DEFER)
+		if (irq != -EPROBE_DEFER)
 			dev_err(&dev->udev->dev,
 				"No IRQ for privacy GPIO (%d)\n", irq);
 		return irq;