[media] au0828: only create V4L2 graph if V4L2 is registered
diff mbox

Message ID 3a61444b9edbcb05dab9d5e6c6703e13ca6dbe3d.1455032887.git.mchehab@osg.samsung.com
State New
Headers show

Commit Message

Mauro Carvalho Chehab Feb. 9, 2016, 3:48 p.m. UTC
It doesn't make sense to try to create the analog TV graph,
if the device fails to register at V4L2, or if it doesn't have
V4L2 support.

Thanks to Shuah for pointing this issue.

Reported-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/usb/au0828/au0828-core.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

Comments

kbuild test robot Feb. 9, 2016, 4:46 p.m. UTC | #1
Hi Mauro,

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.5-rc3 next-20160209]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/au0828-only-create-V4L2-graph-if-V4L2-is-registered/20160209-235135
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-a0-201606 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/media/usb/au0828/au0828-core.c: In function 'au0828_usb_probe':
>> drivers/media/usb/au0828/au0828-core.c:463:1: warning: label 'done' defined but not used [-Wunused-label]
    done:
    ^
   drivers/media/usb/au0828/au0828-core.c: At top level:
   drivers/media/usb/au0828/au0828-core.c:250:12: warning: 'au0828_create_media_graph' defined but not used [-Wunused-function]
    static int au0828_create_media_graph(struct au0828_dev *dev)
               ^

vim +/done +463 drivers/media/usb/au0828/au0828-core.c

265a6510 drivers/media/video/au0828/au0828-core.c Steven Toth              2008-04-18  447  
2fcfd317 drivers/media/usb/au0828/au0828-core.c   Mauro Carvalho Chehab    2014-07-24  448  	/*
2fcfd317 drivers/media/usb/au0828/au0828-core.c   Mauro Carvalho Chehab    2014-07-24  449  	 * Store the pointer to the au0828_dev so it can be accessed in
2fcfd317 drivers/media/usb/au0828/au0828-core.c   Mauro Carvalho Chehab    2014-07-24  450  	 * au0828_usb_disconnect
2fcfd317 drivers/media/usb/au0828/au0828-core.c   Mauro Carvalho Chehab    2014-07-24  451  	 */
fe78a49c drivers/media/video/au0828/au0828-core.c Devin Heitmueller        2009-04-28  452  	usb_set_intfdata(interface, dev);
fe78a49c drivers/media/video/au0828/au0828-core.c Devin Heitmueller        2009-04-28  453  
83afb32a drivers/media/usb/au0828/au0828-core.c   Mauro Carvalho Chehab    2014-08-09  454  	pr_info("Registered device AU0828 [%s]\n",
f1add5b5 drivers/media/video/au0828/au0828-core.c Devin Heitmueller        2009-03-11  455  		dev->board.name == NULL ? "Unset" : dev->board.name);
265a6510 drivers/media/video/au0828/au0828-core.c Steven Toth              2008-04-18  456  
549ee4df drivers/media/video/au0828/au0828-core.c Devin Heitmueller        2012-08-06  457  	mutex_unlock(&dev->lock);
549ee4df drivers/media/video/au0828/au0828-core.c Devin Heitmueller        2012-08-06  458  
9832e155 drivers/media/usb/au0828/au0828-core.c   Javier Martinez Canillas 2015-12-11  459  #ifdef CONFIG_MEDIA_CONTROLLER
9832e155 drivers/media/usb/au0828/au0828-core.c   Javier Martinez Canillas 2015-12-11  460  	retval = media_device_register(dev->media_dev);
9832e155 drivers/media/usb/au0828/au0828-core.c   Javier Martinez Canillas 2015-12-11  461  #endif
9832e155 drivers/media/usb/au0828/au0828-core.c   Javier Martinez Canillas 2015-12-11  462  
9832e155 drivers/media/usb/au0828/au0828-core.c   Javier Martinez Canillas 2015-12-11 @463  done:
9832e155 drivers/media/usb/au0828/au0828-core.c   Javier Martinez Canillas 2015-12-11  464  	if (retval < 0)
9832e155 drivers/media/usb/au0828/au0828-core.c   Javier Martinez Canillas 2015-12-11  465  		au0828_usb_disconnect(interface);
9832e155 drivers/media/usb/au0828/au0828-core.c   Javier Martinez Canillas 2015-12-11  466  
f251b3e7 drivers/media/usb/au0828/au0828-core.c   Tim Mester               2014-01-07  467  	return retval;
265a6510 drivers/media/video/au0828/au0828-core.c Steven Toth              2008-04-18  468  }
265a6510 drivers/media/video/au0828/au0828-core.c Steven Toth              2008-04-18  469  
aaeac199 drivers/media/usb/au0828/au0828-core.c   Mauro Carvalho Chehab    2014-08-09  470  static int au0828_suspend(struct usb_interface *interface,
aaeac199 drivers/media/usb/au0828/au0828-core.c   Mauro Carvalho Chehab    2014-08-09  471  				pm_message_t message)

:::::: The code at line 463 was first introduced by commit
:::::: 9832e155f1ed3030fdfaa19e72c06472dc2ecb1d [media] media-device: split media initialization and registration

:::::: TO: Javier Martinez Canillas <javier@osg.samsung.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Patch
diff mbox

diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index df2bc3f732b6..0a8afbf181c9 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -419,8 +419,21 @@  static int au0828_usb_probe(struct usb_interface *interface,
 
 #ifdef CONFIG_VIDEO_AU0828_V4L2
 	/* Analog TV */
-	if (AUVI_INPUT(0).type != AU0828_VMUX_UNDEFINED)
-		au0828_analog_register(dev, interface);
+	if (AUVI_INPUT(0).type != AU0828_VMUX_UNDEFINED) {
+		retval = au0828_analog_register(dev, interface);
+		if (retval) {
+			pr_err("%s() au0282_dev_register failed to register on V4L2\n",
+			       __func__);
+			goto done;
+		}
+
+		retval = au0828_create_media_graph(dev);
+		if (retval) {
+			pr_err("%s() au0282_dev_register failed to create graph\n",
+			       __func__);
+			goto done;
+		}
+	}
 #endif
 
 	/* Digital TV */
@@ -443,13 +456,6 @@  static int au0828_usb_probe(struct usb_interface *interface,
 
 	mutex_unlock(&dev->lock);
 
-	retval = au0828_create_media_graph(dev);
-	if (retval) {
-		pr_err("%s() au0282_dev_register failed to create graph\n",
-		       __func__);
-		goto done;
-	}
-
 #ifdef CONFIG_MEDIA_CONTROLLER
 	retval = media_device_register(dev->media_dev);
 #endif