Skip to contentSkip to conversation

drivers/gpu/drm/drm_dp_mst_topology.c:514:11-20: ERROR: reference preceded by free on line 514 (fwd)

PATCH New Julia Lawall 1 participant 1 message Jul 2, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 106/119 drivers/gpu/drm/drm_dp_mst_topology.c:514:11-20: ERROR: reference preceded by free on line 514 (fwd)

Hello,

Please check the loop on lines 513-514, which seems to free the same value over and over.

thanks,
julia

---------- Forwarded message ----------
Date: Thu, 2 Jul 2020 18:39:02 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [chrome-os:chromeos-5.4 106/119]
drivers/gpu/drm/drm_dp_mst_topology.c:514:11-20: ERROR: reference preceded by free on line 514

CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <[email protected]>

tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4
head:   11fd567e2203d2b542a5c5dd1b47907375ccc33b
commit: 412be66b38d17634ff346ef30e2820b347e997c0 [106/119] UPSTREAM: drm/dp_mst: Add sideband down request tracing + selftests

:::::: branch date: 5 hours ago
:::::: commit date: 8 hours ago
config: i386-randconfig-c001-20200701 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate

coccinelle warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/drm_dp_mst_topology.c:514:11-20: ERROR: reference preceded by free on line 514

git remote add chrome-os https://chromium.googlesource.com/chromiumos/third_party/kernel
git remote update chrome-os
git checkout 412be66b38d17634ff346ef30e2820b347e997c0
vim +514 drivers/gpu/drm/drm_dp_mst_topology.c

412be66b38d176 Lyude Paul 2019-09-03  413
412be66b38d176 Lyude Paul 2019-09-03  414  /* Decode a sideband request we've encoded, mainly used for debugging */
412be66b38d176 Lyude Paul 2019-09-03  415  int
412be66b38d176 Lyude Paul 2019-09-03  416  drm_dp_decode_sideband_req(const struct drm_dp_sideband_msg_tx *raw,
412be66b38d176 Lyude Paul 2019-09-03  417  			   struct drm_dp_sideband_msg_req_body *req)
412be66b38d176 Lyude Paul 2019-09-03  418  {
412be66b38d176 Lyude Paul 2019-09-03  419  	const u8 *buf = raw->msg;
412be66b38d176 Lyude Paul 2019-09-03  420  	int i, idx = 0;
412be66b38d176 Lyude Paul 2019-09-03  421
412be66b38d176 Lyude Paul 2019-09-03  422  	req->req_type = buf[idx++] & 0x7f;
412be66b38d176 Lyude Paul 2019-09-03  423  	switch (req->req_type) {
412be66b38d176 Lyude Paul 2019-09-03  424  	case DP_ENUM_PATH_RESOURCES:
412be66b38d176 Lyude Paul 2019-09-03  425  	case DP_POWER_DOWN_PHY:
412be66b38d176 Lyude Paul 2019-09-03  426  	case DP_POWER_UP_PHY:
412be66b38d176 Lyude Paul 2019-09-03  427  		req->u.port_num.port_number = (buf[idx] >> 4) & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  428  		break;
412be66b38d176 Lyude Paul 2019-09-03  429  	case DP_ALLOCATE_PAYLOAD:
412be66b38d176 Lyude Paul 2019-09-03  430  		{
412be66b38d176 Lyude Paul 2019-09-03  431  			struct drm_dp_allocate_payload *a =
412be66b38d176 Lyude Paul 2019-09-03  432  				&req->u.allocate_payload;
412be66b38d176 Lyude Paul 2019-09-03  433
412be66b38d176 Lyude Paul 2019-09-03  434  			a->number_sdp_streams = buf[idx] & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  435  			a->port_number = (buf[idx] >> 4) & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  436
412be66b38d176 Lyude Paul 2019-09-03  437  			WARN_ON(buf[++idx] & 0x80);
412be66b38d176 Lyude Paul 2019-09-03  438  			a->vcpi = buf[idx] & 0x7f;
412be66b38d176 Lyude Paul 2019-09-03  439
412be66b38d176 Lyude Paul 2019-09-03  440  			a->pbn = buf[++idx] << 8;
412be66b38d176 Lyude Paul 2019-09-03  441  			a->pbn |= buf[++idx];
412be66b38d176 Lyude Paul 2019-09-03  442
412be66b38d176 Lyude Paul 2019-09-03  443  			idx++;
412be66b38d176 Lyude Paul 2019-09-03  444  			for (i = 0; i < a->number_sdp_streams; i++) {
412be66b38d176 Lyude Paul 2019-09-03  445  				a->sdp_stream_sink[i] =
412be66b38d176 Lyude Paul 2019-09-03  446  					(buf[idx + (i / 2)] >> ((i % 2) ? 0 : 4)) & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  447  			}
412be66b38d176 Lyude Paul 2019-09-03  448  		}
412be66b38d176 Lyude Paul 2019-09-03  449  		break;
412be66b38d176 Lyude Paul 2019-09-03  450  	case DP_QUERY_PAYLOAD:
412be66b38d176 Lyude Paul 2019-09-03  451  		req->u.query_payload.port_number = (buf[idx] >> 4) & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  452  		WARN_ON(buf[++idx] & 0x80);
412be66b38d176 Lyude Paul 2019-09-03  453  		req->u.query_payload.vcpi = buf[idx] & 0x7f;
412be66b38d176 Lyude Paul 2019-09-03  454  		break;
412be66b38d176 Lyude Paul 2019-09-03  455  	case DP_REMOTE_DPCD_READ:
412be66b38d176 Lyude Paul 2019-09-03  456  		{
412be66b38d176 Lyude Paul 2019-09-03  457  			struct drm_dp_remote_dpcd_read *r = &req->u.dpcd_read;
412be66b38d176 Lyude Paul 2019-09-03  458
412be66b38d176 Lyude Paul 2019-09-03  459  			r->port_number = (buf[idx] >> 4) & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  460
412be66b38d176 Lyude Paul 2019-09-03  461  			r->dpcd_address = (buf[idx] << 16) & 0xf0000;
412be66b38d176 Lyude Paul 2019-09-03  462  			r->dpcd_address |= (buf[++idx] << 8) & 0xff00;
412be66b38d176 Lyude Paul 2019-09-03  463  			r->dpcd_address |= buf[++idx] & 0xff;
412be66b38d176 Lyude Paul 2019-09-03  464
412be66b38d176 Lyude Paul 2019-09-03  465  			r->num_bytes = buf[++idx];
412be66b38d176 Lyude Paul 2019-09-03  466  		}
412be66b38d176 Lyude Paul 2019-09-03  467  		break;
412be66b38d176 Lyude Paul 2019-09-03  468  	case DP_REMOTE_DPCD_WRITE:
412be66b38d176 Lyude Paul 2019-09-03  469  		{
412be66b38d176 Lyude Paul 2019-09-03  470  			struct drm_dp_remote_dpcd_write *w =
412be66b38d176 Lyude Paul 2019-09-03  471  				&req->u.dpcd_write;
412be66b38d176 Lyude Paul 2019-09-03  472
412be66b38d176 Lyude Paul 2019-09-03  473  			w->port_number = (buf[idx] >> 4) & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  474
412be66b38d176 Lyude Paul 2019-09-03  475  			w->dpcd_address = (buf[idx] << 16) & 0xf0000;
412be66b38d176 Lyude Paul 2019-09-03  476  			w->dpcd_address |= (buf[++idx] << 8) & 0xff00;
412be66b38d176 Lyude Paul 2019-09-03  477  			w->dpcd_address |= buf[++idx] & 0xff;
412be66b38d176 Lyude Paul 2019-09-03  478
412be66b38d176 Lyude Paul 2019-09-03  479  			w->num_bytes = buf[++idx];
412be66b38d176 Lyude Paul 2019-09-03  480
412be66b38d176 Lyude Paul 2019-09-03  481  			w->bytes = kmemdup(&buf[++idx], w->num_bytes,
412be66b38d176 Lyude Paul 2019-09-03  482  					   GFP_KERNEL);
412be66b38d176 Lyude Paul 2019-09-03  483  			if (!w->bytes)
412be66b38d176 Lyude Paul 2019-09-03  484  				return -ENOMEM;
412be66b38d176 Lyude Paul 2019-09-03  485  		}
412be66b38d176 Lyude Paul 2019-09-03  486  		break;
412be66b38d176 Lyude Paul 2019-09-03  487  	case DP_REMOTE_I2C_READ:
412be66b38d176 Lyude Paul 2019-09-03  488  		{
412be66b38d176 Lyude Paul 2019-09-03  489  			struct drm_dp_remote_i2c_read *r = &req->u.i2c_read;
412be66b38d176 Lyude Paul 2019-09-03  490  			struct drm_dp_remote_i2c_read_tx *tx;
412be66b38d176 Lyude Paul 2019-09-03  491  			bool failed = false;
412be66b38d176 Lyude Paul 2019-09-03  492
412be66b38d176 Lyude Paul 2019-09-03  493  			r->num_transactions = buf[idx] & 0x3;
412be66b38d176 Lyude Paul 2019-09-03  494  			r->port_number = (buf[idx] >> 4) & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  495  			for (i = 0; i < r->num_transactions; i++) {
412be66b38d176 Lyude Paul 2019-09-03  496  				tx = &r->transactions[i];
412be66b38d176 Lyude Paul 2019-09-03  497
412be66b38d176 Lyude Paul 2019-09-03  498  				tx->i2c_dev_id = buf[++idx] & 0x7f;
412be66b38d176 Lyude Paul 2019-09-03  499  				tx->num_bytes = buf[++idx];
412be66b38d176 Lyude Paul 2019-09-03  500  				tx->bytes = kmemdup(&buf[++idx],
412be66b38d176 Lyude Paul 2019-09-03  501  						    tx->num_bytes,
412be66b38d176 Lyude Paul 2019-09-03  502  						    GFP_KERNEL);
412be66b38d176 Lyude Paul 2019-09-03  503  				if (!tx->bytes) {
412be66b38d176 Lyude Paul 2019-09-03  504  					failed = true;
412be66b38d176 Lyude Paul 2019-09-03  505  					break;
412be66b38d176 Lyude Paul 2019-09-03  506  				}
412be66b38d176 Lyude Paul 2019-09-03  507  				idx += tx->num_bytes;
412be66b38d176 Lyude Paul 2019-09-03  508  				tx->no_stop_bit = (buf[idx] >> 5) & 0x1;
412be66b38d176 Lyude Paul 2019-09-03  509  				tx->i2c_transaction_delay = buf[idx] & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  510  			}
412be66b38d176 Lyude Paul 2019-09-03  511
412be66b38d176 Lyude Paul 2019-09-03  512  			if (failed) {
412be66b38d176 Lyude Paul 2019-09-03  513  				for (i = 0; i < r->num_transactions; i++)
412be66b38d176 Lyude Paul 2019-09-03 @514  					kfree(tx->bytes);
412be66b38d176 Lyude Paul 2019-09-03  515  				return -ENOMEM;
412be66b38d176 Lyude Paul 2019-09-03  516  			}
412be66b38d176 Lyude Paul 2019-09-03  517
412be66b38d176 Lyude Paul 2019-09-03  518  			r->read_i2c_device_id = buf[++idx] & 0x7f;
412be66b38d176 Lyude Paul 2019-09-03  519  			r->num_bytes_read = buf[++idx];
412be66b38d176 Lyude Paul 2019-09-03  520  		}
412be66b38d176 Lyude Paul 2019-09-03  521  		break;
412be66b38d176 Lyude Paul 2019-09-03  522  	case DP_REMOTE_I2C_WRITE:
412be66b38d176 Lyude Paul 2019-09-03  523  		{
412be66b38d176 Lyude Paul 2019-09-03  524  			struct drm_dp_remote_i2c_write *w = &req->u.i2c_write;
412be66b38d176 Lyude Paul 2019-09-03  525
412be66b38d176 Lyude Paul 2019-09-03  526  			w->port_number = (buf[idx] >> 4) & 0xf;
412be66b38d176 Lyude Paul 2019-09-03  527  			w->write_i2c_device_id = buf[++idx] & 0x7f;
412be66b38d176 Lyude Paul 2019-09-03  528  			w->num_bytes = buf[++idx];
412be66b38d176 Lyude Paul 2019-09-03  529  			w->bytes = kmemdup(&buf[++idx], w->num_bytes,
412be66b38d176 Lyude Paul 2019-09-03  530  					   GFP_KERNEL);
412be66b38d176 Lyude Paul 2019-09-03  531  			if (!w->bytes)
412be66b38d176 Lyude Paul 2019-09-03  532  				return -ENOMEM;
412be66b38d176 Lyude Paul 2019-09-03  533  		}
412be66b38d176 Lyude Paul 2019-09-03  534  		break;
412be66b38d176 Lyude Paul 2019-09-03  535  	}
412be66b38d176 Lyude Paul 2019-09-03  536
412be66b38d176 Lyude Paul 2019-09-03  537  	return 0;
412be66b38d176 Lyude Paul 2019-09-03  538  }
412be66b38d176 Lyude Paul 2019-09-03  539  EXPORT_SYMBOL_FOR_TESTS_ONLY(drm_dp_decode_sideband_req);
412be66b38d176 Lyude Paul 2019-09-03  540

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org