linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/5] [media] pwc-if: fix build warning when !CONFIG_USB_PWC_INPUT_EVDEV
@ 2014-10-01 23:10 Luis Henriques
  2015-01-15 10:40 ` [3/5, media] " Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Luis Henriques @ 2014-10-01 23:10 UTC (permalink / raw)
  To: Hans de Goede, Mauro Carvalho Chehab; +Cc: linux-media, linux-kernel

Label err_video_unreg in function usb_pwc_probe() is only used when
CONFIG_USB_PWC_INPUT_EVDEV is defined.

drivers/media/usb/pwc/pwc-if.c:1104:1: warning: label 'err_video_unreg' defined but not used [-Wunused-label]

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/media/usb/pwc/pwc-if.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
index 15b754da4a2c..e6b7e63b0b8e 100644
--- a/drivers/media/usb/pwc/pwc-if.c
+++ b/drivers/media/usb/pwc/pwc-if.c
@@ -1078,7 +1078,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
 	pdev->button_dev = input_allocate_device();
 	if (!pdev->button_dev) {
 		rc = -ENOMEM;
-		goto err_video_unreg;
+		video_unregister_device(&pdev->vdev);
+		goto err_unregister_v4l2_dev;
 	}
 
 	usb_make_path(udev, pdev->button_phys, sizeof(pdev->button_phys));
@@ -1095,14 +1096,13 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
 	if (rc) {
 		input_free_device(pdev->button_dev);
 		pdev->button_dev = NULL;
-		goto err_video_unreg;
+		video_unregister_device(&pdev->vdev);
+		goto err_unregister_v4l2_dev;
 	}
 #endif
 
 	return 0;
 
-err_video_unreg:
-	video_unregister_device(&pdev->vdev);
 err_unregister_v4l2_dev:
 	v4l2_device_unregister(&pdev->v4l2_dev);
 err_free_controls:
-- 
2.1.0

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

* Re: [3/5, media] pwc-if: fix build warning when !CONFIG_USB_PWC_INPUT_EVDEV
  2014-10-01 23:10 [PATCH 3/5] [media] pwc-if: fix build warning when !CONFIG_USB_PWC_INPUT_EVDEV Luis Henriques
@ 2015-01-15 10:40 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2015-01-15 10:40 UTC (permalink / raw)
  To: Luis Henriques, Mauro Carvalho Chehab; +Cc: linux-media, linux-kernel

Hi,

On 02-10-14 01:10, Luis Henriques wrote:
> Label err_video_unreg in function usb_pwc_probe() is only used when
> CONFIG_USB_PWC_INPUT_EVDEV is defined.
>
> drivers/media/usb/pwc/pwc-if.c:1104:1: warning: label 'err_video_unreg' defined but not used [-Wunused-label]
>
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>

Sorry for the slow reaction, I somehow missed this patch and just found it in my
patchwork TODO.

I understand what you're trying to achieve here, but NAK to the implementation,
this is breaking the code flow wrt error handling, making it much harder
to double check that everything is being cleaned up properly.

Regards,

Hans


>
> ---
> drivers/media/usb/pwc/pwc-if.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
> index 15b754da4a2c..e6b7e63b0b8e 100644
> --- a/drivers/media/usb/pwc/pwc-if.c
> +++ b/drivers/media/usb/pwc/pwc-if.c
> @@ -1078,7 +1078,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
>   	pdev->button_dev = input_allocate_device();
>   	if (!pdev->button_dev) {
>   		rc = -ENOMEM;
> -		goto err_video_unreg;
> +		video_unregister_device(&pdev->vdev);
> +		goto err_unregister_v4l2_dev;
>   	}
>
>   	usb_make_path(udev, pdev->button_phys, sizeof(pdev->button_phys));
> @@ -1095,14 +1096,13 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
>   	if (rc) {
>   		input_free_device(pdev->button_dev);
>   		pdev->button_dev = NULL;
> -		goto err_video_unreg;
> +		video_unregister_device(&pdev->vdev);
> +		goto err_unregister_v4l2_dev;
>   	}
>   #endif
>
>   	return 0;
>
> -err_video_unreg:
> -	video_unregister_device(&pdev->vdev);
>   err_unregister_v4l2_dev:
>   	v4l2_device_unregister(&pdev->v4l2_dev);
>   err_free_controls:
>

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

end of thread, other threads:[~2015-01-15 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01 23:10 [PATCH 3/5] [media] pwc-if: fix build warning when !CONFIG_USB_PWC_INPUT_EVDEV Luis Henriques
2015-01-15 10:40 ` [3/5, media] " Hans de Goede

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).