All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [agd5f:amd-staging-drm-next 1968/1993] drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
Date: Wed, 10 Mar 2021 20:46:03 +0300	[thread overview]
Message-ID: <20210310174603.GL2087@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 8395 bytes --]

tree:   https://gitlab.freedesktop.org/agd5f/linux.git amd-staging-drm-next
head:   dec2310256916626e4356af784822e02fb807cad
commit: c798c69be8e82c97897a8b6fa4fd8a55624a1509 [1968/1993] drm/amd/display: Added multi instance support for panel control
config: x86_64-randconfig-m001-20210309 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644 Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644 Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644 Yue Hin Lau       2017-09-15   966  {
069d418f412ec4 Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644 Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
c798c69be8e82c Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644 Yue Hin Lau       2017-09-15   970  
069d418f412ec4 Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644 Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644 Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644 Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644 Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   976  
014427adc5565a Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be NULL.

014427adc5565a Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a Sherry            2020-11-11   979  
014427adc5565a Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644 Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644 Yue Hin Lau       2017-09-15   985  		}
014427adc5565a Sherry            2020-11-11   986  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   987  
5eefbc40173644 Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644 Yue Hin Lau       2017-09-15   989  
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644 Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644 Yue Hin Lau       2017-09-15   993  
5eefbc40173644 Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644 Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644 Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625d Andrew Jiang      2017-09-25   997  
5eefbc40173644 Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644 Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644 Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644 Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644 Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644 Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644 Yue Hin Lau       2017-09-15  1005  
5eefbc40173644 Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644 Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644 Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644 Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644 Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644 Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644 Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644 Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644 Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644 Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644 Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7d Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
c798c69be8e82c Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^

This code dereferences it without checking.

5180d4a4766d7d Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7d Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97 Chris Park        2020-08-05  1021  
8a0e210c048e97 Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97 Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97 Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97 Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
c798c69be8e82c Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
c798c69be8e82c Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1028  		else
8a0e210c048e97 Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
c798c69be8e82c Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
c798c69be8e82c Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1032  	}
8a0e210c048e97 Chris Park        2020-08-05  1033  
069d418f412ec4 Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a1331 Hersen Wu         2020-01-14  1035  
96577cf82a1331 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a1331 Hersen Wu         2020-01-14  1038  
96577cf82a1331 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a1331 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a1331 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a1331 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a1331 Hersen Wu         2020-01-14  1043  
69b9723a81e74e Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7d Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337e Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a1331 Hersen Wu         2020-01-14  1047  
96577cf82a1331 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644 Yue Hin Lau       2017-09-15  1050  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41143 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [agd5f:amd-staging-drm-next 1968/1993] drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)
Date: Wed, 10 Mar 2021 20:46:03 +0300	[thread overview]
Message-ID: <20210310174603.GL2087@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 8395 bytes --]

tree:   https://gitlab.freedesktop.org/agd5f/linux.git amd-staging-drm-next
head:   dec2310256916626e4356af784822e02fb807cad
commit: c798c69be8e82c97897a8b6fa4fd8a55624a1509 [1968/1993] drm/amd/display: Added multi instance support for panel control
config: x86_64-randconfig-m001-20210309 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977)

vim +1018 drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c

8a31820b12187c Martin Leung      2019-07-09   963  void dce110_edp_backlight_control(
5eefbc40173644 Yue Hin Lau       2017-09-15   964  		struct dc_link *link,
5eefbc40173644 Yue Hin Lau       2017-09-15   965  		bool enable)
5eefbc40173644 Yue Hin Lau       2017-09-15   966  {
069d418f412ec4 Andrew Jiang      2017-09-26   967  	struct dc_context *ctx = link->ctx;
5eefbc40173644 Yue Hin Lau       2017-09-15   968  	struct bp_transmitter_control cntl = { 0 };
c798c69be8e82c Jake Wang         2021-02-23   969  	uint8_t panel_instance;
5eefbc40173644 Yue Hin Lau       2017-09-15   970  
069d418f412ec4 Andrew Jiang      2017-09-26   971  	if (dal_graphics_object_id_get_connector_id(link->link_enc->connector)
5eefbc40173644 Yue Hin Lau       2017-09-15   972  		!= CONNECTOR_ID_EDP) {
5eefbc40173644 Yue Hin Lau       2017-09-15   973  		BREAK_TO_DEBUGGER();
5eefbc40173644 Yue Hin Lau       2017-09-15   974  		return;
5eefbc40173644 Yue Hin Lau       2017-09-15   975  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   976  
014427adc5565a Sherry            2020-11-11  @977  	if (link->panel_cntl) {
                                                            ^^^^^^^^^^^^^^^^
This code assumes "link->panel_cntl" can be NULL.

014427adc5565a Sherry            2020-11-11   978  		bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
014427adc5565a Sherry            2020-11-11   979  
014427adc5565a Sherry            2020-11-11   980  		if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   981  			DC_LOG_HW_RESUME_S3(
014427adc5565a Sherry            2020-11-11   982  				"%s: panel already powered up/off. Do nothing.\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   983  				__func__);
5eefbc40173644 Yue Hin Lau       2017-09-15   984  			return;
5eefbc40173644 Yue Hin Lau       2017-09-15   985  		}
014427adc5565a Sherry            2020-11-11   986  	}
5eefbc40173644 Yue Hin Lau       2017-09-15   987  
5eefbc40173644 Yue Hin Lau       2017-09-15   988  	/* Send VBIOS command to control eDP panel backlight */
5eefbc40173644 Yue Hin Lau       2017-09-15   989  
1296423bf23c7a Bhawanpreet Lakha 2018-02-20   990  	DC_LOG_HW_RESUME_S3(
5eefbc40173644 Yue Hin Lau       2017-09-15   991  			"%s: backlight action: %s\n",
5eefbc40173644 Yue Hin Lau       2017-09-15   992  			__func__, (enable ? "On":"Off"));
5eefbc40173644 Yue Hin Lau       2017-09-15   993  
5eefbc40173644 Yue Hin Lau       2017-09-15   994  	cntl.action = enable ?
5eefbc40173644 Yue Hin Lau       2017-09-15   995  		TRANSMITTER_CONTROL_BACKLIGHT_ON :
5eefbc40173644 Yue Hin Lau       2017-09-15   996  		TRANSMITTER_CONTROL_BACKLIGHT_OFF;
8740196935625d Andrew Jiang      2017-09-25   997  
5eefbc40173644 Yue Hin Lau       2017-09-15   998  	/*cntl.engine_id = ctx->engine;*/
5eefbc40173644 Yue Hin Lau       2017-09-15   999  	cntl.transmitter = link->link_enc->transmitter;
5eefbc40173644 Yue Hin Lau       2017-09-15  1000  	cntl.connector_obj_id = link->link_enc->connector;
5eefbc40173644 Yue Hin Lau       2017-09-15  1001  	/*todo: unhardcode*/
5eefbc40173644 Yue Hin Lau       2017-09-15  1002  	cntl.lanes_number = LANE_COUNT_FOUR;
5eefbc40173644 Yue Hin Lau       2017-09-15  1003  	cntl.hpd_sel = link->link_enc->hpd_source;
cf1835f03ffb3b Charlene Liu      2018-01-08  1004  	cntl.signal = SIGNAL_TYPE_EDP;
5eefbc40173644 Yue Hin Lau       2017-09-15  1005  
5eefbc40173644 Yue Hin Lau       2017-09-15  1006  	/* For eDP, the following delays might need to be considered
5eefbc40173644 Yue Hin Lau       2017-09-15  1007  	 * after link training completed:
5eefbc40173644 Yue Hin Lau       2017-09-15  1008  	 * idle period - min. accounts for required BS-Idle pattern,
5eefbc40173644 Yue Hin Lau       2017-09-15  1009  	 * max. allows for source frame synchronization);
5eefbc40173644 Yue Hin Lau       2017-09-15  1010  	 * 50 msec max. delay from valid video data from source
5eefbc40173644 Yue Hin Lau       2017-09-15  1011  	 * to video on dislpay or backlight enable.
5eefbc40173644 Yue Hin Lau       2017-09-15  1012  	 *
5eefbc40173644 Yue Hin Lau       2017-09-15  1013  	 * Disable the delay for now.
5eefbc40173644 Yue Hin Lau       2017-09-15  1014  	 * Enable it in the future if necessary.
5eefbc40173644 Yue Hin Lau       2017-09-15  1015  	 */
5eefbc40173644 Yue Hin Lau       2017-09-15  1016  	/* dc_service_sleep_in_milliseconds(50); */
5180d4a4766d7d Charlene Liu      2018-01-18  1017  		/*edp 1.2*/
c798c69be8e82c Jake Wang         2021-02-23 @1018  	panel_instance = link->panel_cntl->inst;
                                                                         ^^^^^^^^^^^^^^^^

This code dereferences it without checking.

5180d4a4766d7d Charlene Liu      2018-01-18  1019  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
5180d4a4766d7d Charlene Liu      2018-01-18  1020  		edp_receiver_ready_T7(link);
8a0e210c048e97 Chris Park        2020-08-05  1021  
8a0e210c048e97 Chris Park        2020-08-05  1022  	if (ctx->dc->ctx->dmub_srv &&
8a0e210c048e97 Chris Park        2020-08-05  1023  			ctx->dc->debug.dmub_command_table) {
8a0e210c048e97 Chris Park        2020-08-05  1024  		if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON)
8a0e210c048e97 Chris Park        2020-08-05  1025  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
c798c69be8e82c Jake Wang         2021-02-23  1026  					LVTMA_CONTROL_LCD_BLON,
c798c69be8e82c Jake Wang         2021-02-23  1027  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1028  		else
8a0e210c048e97 Chris Park        2020-08-05  1029  			ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios,
c798c69be8e82c Jake Wang         2021-02-23  1030  					LVTMA_CONTROL_LCD_BLOFF,
c798c69be8e82c Jake Wang         2021-02-23  1031  					panel_instance);
8a0e210c048e97 Chris Park        2020-08-05  1032  	}
8a0e210c048e97 Chris Park        2020-08-05  1033  
069d418f412ec4 Andrew Jiang      2017-09-26  1034  	link_transmitter_control(ctx->dc_bios, &cntl);
96577cf82a1331 Hersen Wu         2020-01-14  1035  
96577cf82a1331 Hersen Wu         2020-01-14  1036  	if (enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1037  		msleep(OLED_POST_T7_DELAY);
96577cf82a1331 Hersen Wu         2020-01-14  1038  
96577cf82a1331 Hersen Wu         2020-01-14  1039  	if (link->dpcd_sink_ext_caps.bits.oled ||
96577cf82a1331 Hersen Wu         2020-01-14  1040  		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
96577cf82a1331 Hersen Wu         2020-01-14  1041  		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)
96577cf82a1331 Hersen Wu         2020-01-14  1042  		dc_link_backlight_enable_aux(link, enable);
96577cf82a1331 Hersen Wu         2020-01-14  1043  
69b9723a81e74e Charlene Liu      2018-01-18  1044  	/*edp 1.2*/
5180d4a4766d7d Charlene Liu      2018-01-18  1045  	if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_OFF)
3a372bed1e337e Hugo Hu           2020-10-06  1046  		edp_add_delay_for_T9(link);
96577cf82a1331 Hersen Wu         2020-01-14  1047  
96577cf82a1331 Hersen Wu         2020-01-14  1048  	if (!enable && link->dpcd_sink_ext_caps.bits.oled)
96577cf82a1331 Hersen Wu         2020-01-14  1049  		msleep(OLED_PRE_T11_DELAY);
5eefbc40173644 Yue Hin Lau       2017-09-15  1050  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41143 bytes --]

             reply	other threads:[~2021-03-10 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 17:46 Dan Carpenter [this message]
2021-03-10 17:46 ` [agd5f:amd-staging-drm-next 1968/1993] drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1018 dce110_edp_backlight_control() error: we previously assumed 'link->panel_cntl' could be null (see line 977) Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-03-10 15:32 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210310174603.GL2087@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.