[PATCH v2 9/9] drm/bridge: ti-sn65dsi86: Avoid invalid rates

kbuild test robot lkp at intel.com
Sat Dec 21 13:56:47 UTC 2019


Hi Douglas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.5-rc2 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Douglas-Anderson/drm-bridge-ti-sn65dsi86-Improve-support-for-AUO-B116XAK01-other-DP/20191221-083448
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7e0165b2f1a912a06e381e91f0f4e495f4ac3736
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>

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/bridge/ti-sn65dsi86.c: In function 'ti_sn_bridge_enable':
>> drivers/gpu/drm/bridge/ti-sn65dsi86.c:543:18: warning: 'rate_valid' may be used uninitialized in this function [-Wmaybe-uninitialized]
       if (rate_valid[i])
           ~~~~~~~~~~^~~

vim +/rate_valid +543 drivers/gpu/drm/bridge/ti-sn65dsi86.c

   477	
   478	static void ti_sn_bridge_read_valid_rates(struct ti_sn_bridge *pdata,
   479						  bool rate_valid[])
   480	{
   481		u8 dpcd_val;
   482		int rate_times_200khz;
   483		int ret;
   484		int i;
   485	
   486		ret = drm_dp_dpcd_readb(&pdata->aux, DP_EDP_DPCD_REV, &dpcd_val);
   487		if (ret != 1) {
   488			DRM_DEV_ERROR(pdata->dev,
   489				      "Can't read eDP rev (%d), assuming 1.1\n", ret);
   490			dpcd_val = DP_EDP_11;
   491		}
   492	
   493		if (dpcd_val >= DP_EDP_14) {
   494			/* eDP 1.4 devices must provide a custom table */
   495			__le16 sink_rates[DP_MAX_SUPPORTED_RATES];
   496	
   497			ret = drm_dp_dpcd_read(&pdata->aux, DP_SUPPORTED_LINK_RATES,
   498					       sink_rates, sizeof(sink_rates));
   499	
   500			if (ret != sizeof(sink_rates)) {
   501				DRM_DEV_ERROR(pdata->dev,
   502					"Can't read supported rate table (%d)\n", ret);
   503	
   504				/* By zeroing we'll fall back to DP_MAX_LINK_RATE. */
   505				memset(sink_rates, 0, sizeof(sink_rates));
   506			}
   507	
   508			for (i = 0; i < ARRAY_SIZE(sink_rates); i++) {
   509				rate_times_200khz = le16_to_cpu(sink_rates[i]);
   510	
   511				if (!rate_times_200khz)
   512					break;
   513	
   514				switch (rate_times_200khz) {
   515				case 27000:
   516					rate_valid[7] = 1;
   517					break;
   518				case 21600:
   519					rate_valid[6] = 1;
   520					break;
   521				case 16200:
   522					rate_valid[5] = 1;
   523					break;
   524				case 13500:
   525					rate_valid[4] = 1;
   526					break;
   527				case 12150:
   528					rate_valid[3] = 1;
   529					break;
   530				case 10800:
   531					rate_valid[2] = 1;
   532					break;
   533				case 8100:
   534					rate_valid[1] = 1;
   535					break;
   536				default:
   537					/* unsupported */
   538					break;
   539				}
   540			}
   541	
   542			for (i = 0; i < ARRAY_SIZE(ti_sn_bridge_dp_rate_lut); i++) {
 > 543				if (rate_valid[i])
   544					return;
   545			}
   546			DRM_DEV_ERROR(pdata->dev,
   547				      "No matching eDP rates in table; falling back\n");
   548		}
   549	
   550		/* On older versions best we can do is use DP_MAX_LINK_RATE */
   551		ret = drm_dp_dpcd_readb(&pdata->aux, DP_MAX_LINK_RATE, &dpcd_val);
   552		if (ret != 1) {
   553			DRM_DEV_ERROR(pdata->dev,
   554				      "Can't read max rate (%d); assuming 5.4 GHz\n",
   555				      ret);
   556			dpcd_val = DP_LINK_BW_5_4;
   557		}
   558	
   559		switch (dpcd_val) {
   560		default:
   561			DRM_DEV_ERROR(pdata->dev,
   562				      "Unexpected max rate (%#x); assuming 5.4 GHz\n",
   563				      (int)dpcd_val);
   564			/* fall through */
   565		case DP_LINK_BW_5_4:
   566			rate_valid[7] = 1;
   567			/* fall through */
   568		case DP_LINK_BW_2_7:
   569			rate_valid[4] = 1;
   570			/* fall through */
   571		case DP_LINK_BW_1_62:
   572			rate_valid[1] = 1;
   573			break;
   574		}
   575	}
   576	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 52817 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20191221/ec77f212/attachment-0001.gz>


More information about the dri-devel mailing list