[Intel-gfx] [PATCH 6/8] drm/nouveau: Use drm_for_each_connector_encoder_ids()

kbuild test robot lkp at intel.com
Tue Jun 26 20:55:37 UTC 2018


Hi Ville,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.18-rc2 next-20180626]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-Second-attempt-at-fixing-the-fb-helper-best_encoder-mess/20180627-024018
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: x86_64-randconfig-x012-201825 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/gpu//drm/nouveau/nouveau_connector.c: In function 'nouveau_connector_detect':
>> drivers/gpu//drm/nouveau/nouveau_connector.c:606:33: warning: 'nv_encoder' may be used uninitialized in this function [-Wmaybe-uninitialized]
      if (nv_partner && ((nv_encoder->dcb->type == DCB_OUTPUT_ANALOG &&
                          ~~~~~~~~~~^~~~~

vim +/nv_encoder +606 drivers/gpu//drm/nouveau/nouveau_connector.c

6ee73861 Ben Skeggs        2009-12-11  546  
6ee73861 Ben Skeggs        2009-12-11  547  static enum drm_connector_status
930a9e28 Chris Wilson      2010-09-14  548  nouveau_connector_detect(struct drm_connector *connector, bool force)
6ee73861 Ben Skeggs        2009-12-11  549  {
6ee73861 Ben Skeggs        2009-12-11  550  	struct drm_device *dev = connector->dev;
77145f1c Ben Skeggs        2012-07-31  551  	struct nouveau_drm *drm = nouveau_drm(dev);
6ee73861 Ben Skeggs        2009-12-11  552  	struct nouveau_connector *nv_connector = nouveau_connector(connector);
6ee73861 Ben Skeggs        2009-12-11  553  	struct nouveau_encoder *nv_encoder = NULL;
e19b20bb Ben Skeggs        2011-07-12  554  	struct nouveau_encoder *nv_partner;
2aa5eac5 Ben Skeggs        2015-08-20  555  	struct i2c_adapter *i2c;
03cd06ca Francisco Jerez   2010-07-20  556  	int type;
5addcf0a Dave Airlie       2012-09-10  557  	int ret;
5addcf0a Dave Airlie       2012-09-10  558  	enum drm_connector_status conn_status = connector_status_disconnected;
6ee73861 Ben Skeggs        2009-12-11  559  
b8780e2a Francisco Jerez   2010-01-14  560  	/* Cleanup the previous EDID block. */
b8780e2a Francisco Jerez   2010-01-14  561  	if (nv_connector->edid) {
b8780e2a Francisco Jerez   2010-01-14  562  		drm_mode_connector_update_edid_property(connector, NULL);
c8ebe275 Xavier Chantry    2010-01-11  563  		kfree(nv_connector->edid);
c8ebe275 Xavier Chantry    2010-01-11  564  		nv_connector->edid = NULL;
b8780e2a Francisco Jerez   2010-01-14  565  	}
c8ebe275 Xavier Chantry    2010-01-11  566  
d61a5c10 Lukas Wunner      2018-02-11  567  	/* Outputs are only polled while runtime active, so acquiring a
d61a5c10 Lukas Wunner      2018-02-11  568  	 * runtime PM ref here is unnecessary (and would deadlock upon
d61a5c10 Lukas Wunner      2018-02-11  569  	 * runtime suspend because it waits for polling to finish).
d61a5c10 Lukas Wunner      2018-02-11  570  	 */
d61a5c10 Lukas Wunner      2018-02-11  571  	if (!drm_kms_helper_is_poll_worker()) {
5addcf0a Dave Airlie       2012-09-10  572  		ret = pm_runtime_get_sync(connector->dev->dev);
b6c4285a Alexandre Courbot 2014-02-12  573  		if (ret < 0 && ret != -EACCES)
5addcf0a Dave Airlie       2012-09-10  574  			return conn_status;
d61a5c10 Lukas Wunner      2018-02-11  575  	}
5addcf0a Dave Airlie       2012-09-10  576  
8777c5c1 Ben Skeggs        2014-06-06  577  	nv_encoder = nouveau_connector_ddc_detect(connector);
8777c5c1 Ben Skeggs        2014-06-06  578  	if (nv_encoder && (i2c = nv_encoder->i2c) != NULL) {
39c1c901 Lukas Wunner      2016-01-11  579  		if ((vga_switcheroo_handler_flags() &
39c1c901 Lukas Wunner      2016-01-11  580  		     VGA_SWITCHEROO_CAN_SWITCH_DDC) &&
39c1c901 Lukas Wunner      2016-01-11  581  		    nv_connector->type == DCB_CONNECTOR_LVDS)
39c1c901 Lukas Wunner      2016-01-11  582  			nv_connector->edid = drm_get_edid_switcheroo(connector,
39c1c901 Lukas Wunner      2016-01-11  583  								     i2c);
39c1c901 Lukas Wunner      2016-01-11  584  		else
2aa5eac5 Ben Skeggs        2015-08-20  585  			nv_connector->edid = drm_get_edid(connector, i2c);
39c1c901 Lukas Wunner      2016-01-11  586  
6ee73861 Ben Skeggs        2009-12-11  587  		drm_mode_connector_update_edid_property(connector,
6ee73861 Ben Skeggs        2009-12-11  588  							nv_connector->edid);
6ee73861 Ben Skeggs        2009-12-11  589  		if (!nv_connector->edid) {
77145f1c Ben Skeggs        2012-07-31  590  			NV_ERROR(drm, "DDC responded, but no EDID for %s\n",
8c6c361a Jani Nikula       2014-06-03  591  				 connector->name);
0ed3165e Francisco Jerez   2010-01-14  592  			goto detect_analog;
6ee73861 Ben Skeggs        2009-12-11  593  		}
6ee73861 Ben Skeggs        2009-12-11  594  
6ee73861 Ben Skeggs        2009-12-11  595  		/* Override encoder type for DVI-I based on whether EDID
6ee73861 Ben Skeggs        2009-12-11  596  		 * says the display is digital or analog, both use the
6ee73861 Ben Skeggs        2009-12-11  597  		 * same i2c channel so the value returned from ddc_detect
6ee73861 Ben Skeggs        2009-12-11  598  		 * isn't necessarily correct.
6ee73861 Ben Skeggs        2009-12-11  599  		 */
e19b20bb Ben Skeggs        2011-07-12  600  		nv_partner = NULL;
cb75d97e Ben Skeggs        2012-07-11  601  		if (nv_encoder->dcb->type == DCB_OUTPUT_TMDS)
cb75d97e Ben Skeggs        2012-07-11  602  			nv_partner = find_encoder(connector, DCB_OUTPUT_ANALOG);
cb75d97e Ben Skeggs        2012-07-11  603  		if (nv_encoder->dcb->type == DCB_OUTPUT_ANALOG)
cb75d97e Ben Skeggs        2012-07-11  604  			nv_partner = find_encoder(connector, DCB_OUTPUT_TMDS);
cb75d97e Ben Skeggs        2012-07-11  605  
cb75d97e Ben Skeggs        2012-07-11 @606  		if (nv_partner && ((nv_encoder->dcb->type == DCB_OUTPUT_ANALOG &&
cb75d97e Ben Skeggs        2012-07-11  607  				    nv_partner->dcb->type == DCB_OUTPUT_TMDS) ||
cb75d97e Ben Skeggs        2012-07-11  608  				   (nv_encoder->dcb->type == DCB_OUTPUT_TMDS &&
cb75d97e Ben Skeggs        2012-07-11  609  				    nv_partner->dcb->type == DCB_OUTPUT_ANALOG))) {
6ee73861 Ben Skeggs        2009-12-11  610  			if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL)
cb75d97e Ben Skeggs        2012-07-11  611  				type = DCB_OUTPUT_TMDS;
6ee73861 Ben Skeggs        2009-12-11  612  			else
cb75d97e Ben Skeggs        2012-07-11  613  				type = DCB_OUTPUT_ANALOG;
6ee73861 Ben Skeggs        2009-12-11  614  
e19b20bb Ben Skeggs        2011-07-12  615  			nv_encoder = find_encoder(connector, type);
6ee73861 Ben Skeggs        2009-12-11  616  		}
6ee73861 Ben Skeggs        2009-12-11  617  
6ee73861 Ben Skeggs        2009-12-11  618  		nouveau_connector_set_encoder(connector, nv_encoder);
5addcf0a Dave Airlie       2012-09-10  619  		conn_status = connector_status_connected;
5addcf0a Dave Airlie       2012-09-10  620  		goto out;
6ee73861 Ben Skeggs        2009-12-11  621  	}
6ee73861 Ben Skeggs        2009-12-11  622  
c16c5707 Francisco Jerez   2010-09-09  623  	nv_encoder = nouveau_connector_of_detect(connector);
c16c5707 Francisco Jerez   2010-09-09  624  	if (nv_encoder) {
c16c5707 Francisco Jerez   2010-09-09  625  		nouveau_connector_set_encoder(connector, nv_encoder);
5addcf0a Dave Airlie       2012-09-10  626  		conn_status = connector_status_connected;
5addcf0a Dave Airlie       2012-09-10  627  		goto out;
c16c5707 Francisco Jerez   2010-09-09  628  	}
c16c5707 Francisco Jerez   2010-09-09  629  
0ed3165e Francisco Jerez   2010-01-14  630  detect_analog:
cb75d97e Ben Skeggs        2012-07-11  631  	nv_encoder = find_encoder(connector, DCB_OUTPUT_ANALOG);
f4053509 Ben Skeggs        2010-03-15  632  	if (!nv_encoder && !nouveau_tv_disable)
cb75d97e Ben Skeggs        2012-07-11  633  		nv_encoder = find_encoder(connector, DCB_OUTPUT_TV);
84b8081c Francisco Jerez   2010-10-26  634  	if (nv_encoder && force) {
6ee73861 Ben Skeggs        2009-12-11  635  		struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
d58ded76 Jani Nikula       2015-03-11  636  		const struct drm_encoder_helper_funcs *helper =
6ee73861 Ben Skeggs        2009-12-11  637  						encoder->helper_private;
6ee73861 Ben Skeggs        2009-12-11  638  
6ee73861 Ben Skeggs        2009-12-11  639  		if (helper->detect(encoder, connector) ==
6ee73861 Ben Skeggs        2009-12-11  640  						connector_status_connected) {
6ee73861 Ben Skeggs        2009-12-11  641  			nouveau_connector_set_encoder(connector, nv_encoder);
5addcf0a Dave Airlie       2012-09-10  642  			conn_status = connector_status_connected;
5addcf0a Dave Airlie       2012-09-10  643  			goto out;
6ee73861 Ben Skeggs        2009-12-11  644  		}
6ee73861 Ben Skeggs        2009-12-11  645  
6ee73861 Ben Skeggs        2009-12-11  646  	}
6ee73861 Ben Skeggs        2009-12-11  647  
5addcf0a Dave Airlie       2012-09-10  648   out:
5addcf0a Dave Airlie       2012-09-10  649  
d61a5c10 Lukas Wunner      2018-02-11  650  	if (!drm_kms_helper_is_poll_worker()) {
5addcf0a Dave Airlie       2012-09-10  651  		pm_runtime_mark_last_busy(connector->dev->dev);
5addcf0a Dave Airlie       2012-09-10  652  		pm_runtime_put_autosuspend(connector->dev->dev);
d61a5c10 Lukas Wunner      2018-02-11  653  	}
5addcf0a Dave Airlie       2012-09-10  654  
5addcf0a Dave Airlie       2012-09-10  655  	return conn_status;
6ee73861 Ben Skeggs        2009-12-11  656  }
6ee73861 Ben Skeggs        2009-12-11  657  

:::::: The code at line 606 was first introduced by commit
:::::: cb75d97e9c77743ecfcc43375be135a55a4d9b25 drm/nouveau: implement devinit subdev, and new init table parser

:::::: TO: Ben Skeggs <bskeggs at redhat.com>
:::::: CC: Ben Skeggs <bskeggs at redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 27704 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20180627/3ec58ef9/attachment-0001.gz>


More information about the Intel-gfx mailing list