tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: e47eb90a0a9ae20b82635b9b99a8d0979b757ad8 commit: 4d07b0bc403403438d9cf88450506240c5faf92f [2257/4736] drm/display/dp_mst: Move all payload info into the atomic state compiler: alpha-linux-gcc (GCC) 12.1.0 reproduce (cppcheck warning): # apt-get install cppcheck git checkout 4d07b0bc403403438d9cf88450506240c5faf92f cppcheck --quiet --enable=style,performance,portability --template=gcc FILE If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@xxxxxxxxx> cppcheck warnings: (new ones prefixed by >>) >> drivers/gpu/drm/display/drm_dp_mst_topology.c:4780:7: warning: Local variable 'ret' shadows outer variable [shadowVariable] int ret; ^ drivers/gpu/drm/display/drm_dp_mst_topology.c:4737:9: note: Shadowed declaration int i, ret; ^ drivers/gpu/drm/display/drm_dp_mst_topology.c:4780:7: note: Shadow variable int ret; ^ cppcheck possible warnings: (new ones prefixed by >>, may not real problems) >> drivers/gpu/drm/drm_mipi_dsi.c:307:73: warning: Parameter 'node' can be declared with const [constParameter] struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node) ^ -- drivers/gpu/drm/display/drm_dp_mst_topology.c:5003:34: warning: Parameter 'branch' can be declared with const [constParameter] struct drm_dp_mst_branch *branch) ^ >> drivers/gpu/drm/display/drm_dp_mst_topology.c:1691:30: warning: Parameter 'port' can be declared with const [constParameter] struct drm_dp_mst_port *port) ^ vim +/ret +4780 drivers/gpu/drm/display/drm_dp_mst_topology.c 51108f252b02d3 drivers/gpu/drm/drm_dp_mst_topology.c Jim Bride 2016-04-14 4724 ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4725 /** ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4726 * drm_dp_mst_dump_topology(): dump topology to seq file. ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4727 * @m: seq_file to dump output to ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4728 * @mgr: manager to dump current topology for. ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4729 * ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4730 * helper to dump MST topology to a seq file for debugfs. ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4731 */ ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4732 void drm_dp_mst_dump_topology(struct seq_file *m, ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4733 struct drm_dp_mst_topology_mgr *mgr) ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4734 { 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4735 struct drm_dp_mst_topology_state *state; 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4736 struct drm_dp_mst_atomic_payload *payload; 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4737 int i, ret; 51108f252b02d3 drivers/gpu/drm/drm_dp_mst_topology.c Jim Bride 2016-04-14 4738 ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4739 mutex_lock(&mgr->lock); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4740 if (mgr->mst_primary) ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4741 drm_dp_mst_dump_mstb(m, mgr->mst_primary); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4742 ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4743 /* dump VCPIs */ ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4744 mutex_unlock(&mgr->lock); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4745 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4746 ret = drm_modeset_lock_single_interruptible(&mgr->base.lock); 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4747 if (ret < 0) 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4748 return; 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4749 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4750 state = to_drm_dp_mst_topology_state(mgr->base.state); 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4751 seq_printf(m, "\n*** Atomic state info ***\n"); 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4752 seq_printf(m, "payload_mask: %x, max_payloads: %d, start_slot: %u, pbn_div: %d\n", 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4753 state->payload_mask, mgr->max_payloads, state->start_slot, state->pbn_div); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4754 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4755 seq_printf(m, "\n| idx | port | vcpi | slots | pbn | dsc | sink name |\n"); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4756 for (i = 0; i < mgr->max_payloads; i++) { 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4757 list_for_each_entry(payload, &state->payloads, next) { 51108f252b02d3 drivers/gpu/drm/drm_dp_mst_topology.c Jim Bride 2016-04-14 4758 char name[14]; 51108f252b02d3 drivers/gpu/drm/drm_dp_mst_topology.c Jim Bride 2016-04-14 4759 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4760 if (payload->vcpi != i || payload->delete) 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4761 continue; 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4762 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4763 fetch_monitor_name(mgr, payload->port, name, sizeof(name)); 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4764 seq_printf(m, " %5d %6d %6d %02d - %02d %5d %5s %19s\n", e55f2ffc4dc105 drivers/gpu/drm/drm_dp_mst_topology.c Eryk Brol 2021-03-25 4765 i, 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4766 payload->port->port_num, 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4767 payload->vcpi, 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4768 payload->vc_start_slot, 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4769 payload->vc_start_slot + payload->time_slots - 1, 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4770 payload->pbn, 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4771 payload->dsc_enabled ? "Y" : "N", 51108f252b02d3 drivers/gpu/drm/drm_dp_mst_topology.c Jim Bride 2016-04-14 4772 (*name != 0) ? name : "Unknown"); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4773 } ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4774 } ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4775 e55f2ffc4dc105 drivers/gpu/drm/drm_dp_mst_topology.c Eryk Brol 2021-03-25 4776 seq_printf(m, "\n*** DPCD Info ***\n"); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4777 mutex_lock(&mgr->lock); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4778 if (mgr->mst_primary) { 7056a2bccc3b5a drivers/gpu/drm/drm_dp_mst_topology.c Andy Shevchenko 2018-03-19 4779 u8 buf[DP_PAYLOAD_TABLE_SIZE]; ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 @4780 int ret; 46466b0dac3f6b drivers/gpu/drm/drm_dp_mst_topology.c Joe Perches 2017-05-30 4781 7a710a8bc90931 drivers/gpu/drm/display/drm_dp_mst_topology.c Imre Deak 2022-06-14 4782 if (drm_dp_read_dpcd_caps(mgr->aux, buf) < 0) { cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4783 seq_printf(m, "dpcd read failed\n"); cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4784 goto out; cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4785 } 46466b0dac3f6b drivers/gpu/drm/drm_dp_mst_topology.c Joe Perches 2017-05-30 4786 seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf); cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4787 ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4788 ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2); 2ac6cdd581f48c drivers/gpu/drm/display/drm_dp_mst_topology.c Simon Ser 2022-02-10 4789 if (ret != 2) { cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4790 seq_printf(m, "faux/mst read failed\n"); cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4791 goto out; cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4792 } 46466b0dac3f6b drivers/gpu/drm/drm_dp_mst_topology.c Joe Perches 2017-05-30 4793 seq_printf(m, "faux/mst: %*ph\n", 2, buf); cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4794 ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4795 ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1); 2ac6cdd581f48c drivers/gpu/drm/display/drm_dp_mst_topology.c Simon Ser 2022-02-10 4796 if (ret != 1) { cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4797 seq_printf(m, "mst ctrl read failed\n"); cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4798 goto out; cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4799 } 46466b0dac3f6b drivers/gpu/drm/drm_dp_mst_topology.c Joe Perches 2017-05-30 4800 seq_printf(m, "mst ctrl: %*ph\n", 1, buf); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4801 44790462d041d3 drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2015-07-14 4802 /* dump the standard OUI branch header */ 44790462d041d3 drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2015-07-14 4803 ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE); 2ac6cdd581f48c drivers/gpu/drm/display/drm_dp_mst_topology.c Simon Ser 2022-02-10 4804 if (ret != DP_BRANCH_OUI_HEADER_SIZE) { cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4805 seq_printf(m, "branch oui read failed\n"); cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4806 goto out; cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4807 } 46466b0dac3f6b drivers/gpu/drm/drm_dp_mst_topology.c Joe Perches 2017-05-30 4808 seq_printf(m, "branch oui: %*phN devid: ", 3, buf); cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4809 51108f252b02d3 drivers/gpu/drm/drm_dp_mst_topology.c Jim Bride 2016-04-14 4810 for (i = 0x3; i < 0x8 && buf[i]; i++) 44790462d041d3 drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2015-07-14 4811 seq_printf(m, "%c", buf[i]); 46466b0dac3f6b drivers/gpu/drm/drm_dp_mst_topology.c Joe Perches 2017-05-30 4812 seq_printf(m, " revision: hw: %x.%x sw: %x.%x\n", 46466b0dac3f6b drivers/gpu/drm/drm_dp_mst_topology.c Joe Perches 2017-05-30 4813 buf[0x9] >> 4, buf[0x9] & 0xf, buf[0xa], buf[0xb]); 46466b0dac3f6b drivers/gpu/drm/drm_dp_mst_topology.c Joe Perches 2017-05-30 4814 if (dump_dp_payload_table(mgr, buf)) 7056a2bccc3b5a drivers/gpu/drm/drm_dp_mst_topology.c Andy Shevchenko 2018-03-19 4815 seq_printf(m, "payload table: %*ph\n", DP_PAYLOAD_TABLE_SIZE, buf); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4816 } ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4817 cb897542c6d2b3 drivers/gpu/drm/drm_dp_mst_topology.c Benjamin Gaignard 2020-02-05 4818 out: ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4819 mutex_unlock(&mgr->lock); 4d07b0bc403403 drivers/gpu/drm/display/drm_dp_mst_topology.c Lyude Paul 2022-08-17 4820 drm_modeset_unlock(&mgr->base.lock); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4821 } ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4822 EXPORT_SYMBOL(drm_dp_mst_dump_topology); ad7f8a1f9ced7f drivers/gpu/drm/drm_dp_mst_topology.c Dave Airlie 2014-06-05 4823 :::::: The code at line 4780 was first introduced by commit :::::: ad7f8a1f9ced7f049f9b66d588723f243a7034cd drm/helper: add Displayport multi-stream helper (v0.6) :::::: TO: Dave Airlie <airlied@xxxxxxxxxx> :::::: CC: Dave Airlie <airlied@xxxxxxxxxx> -- 0-DAY CI Kernel Test Service https://01.org/lkp