diff mbox series

[1/8] Critical KlockWork Error - Fixes - intel_cdclk.c - Possible NullPointerDereference1

Message ID 20200814024950.26830-1-nischal.varide@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/8] Critical KlockWork Error - Fixes - intel_cdclk.c - Possible NullPointerDereference1 | expand

Commit Message

Nischal Varide Aug. 14, 2020, 2:49 a.m. UTC
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

Comments

Shankar, Uma Aug. 14, 2020, 1:35 p.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Patchwork
> Sent: Friday, August 14, 2020 3:44 PM
> To: Varide, Nischal <nischal.varide@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/8]
> Critical KlockWork Error - Fixes - intel_cdclk.c - Possible NullPointerDereference1
> 
> == Series Details ==
> 
> Series: series starting with [1/8] Critical KlockWork Error - Fixes - intel_cdclk.c -
> Possible NullPointerDereference1
> URL   : https://patchwork.freedesktop.org/series/80622/
> State : warning

Please fix the checkpatch warnings and resend.

> == Summary ==
> 
> $ dim checkpatch origin/drm-tip
> b5bd9c17f5da Critical KlockWork Error - Fixes - intel_cdclk.c - Possible
> NullPointerDereference1
> -:9: WARNING:COMMIT_MESSAGE: Missing commit description - Add an
> appropriate one
> 
> -:36: CHECK:LINE_SPACING: Please don't use multiple blank lines
> #36: FILE: drivers/gpu/drm/i915/display/intel_cdclk.c:1968:
> +
> +
> 
> -:49: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
> 
> total: 1 errors, 1 warnings, 1 checks, 35 lines checked
> 40f6a6747f32 Critical KlockWork Error - Fixes - intel_atomic.c - Possible
> NullPointerDereference1
> -:9: WARNING:COMMIT_MESSAGE: Missing commit description - Add an
> appropriate one
> 
> -:20: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
> 
> total: 1 errors, 1 warnings, 0 checks, 8 lines checked 72231b698a7d Critical
> KlockWork Error - Fixes - intel_fbdev.c - Possible NullPointerDereference1
> -:9: WARNING:COMMIT_MESSAGE: Missing commit description - Add an
> appropriate one
> 
> -:18: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional
> statements (8, 12)
> #18: FILE: drivers/gpu/drm/i915/display/intel_fbdev.c:598:
> +	if (ifbdev->fb && intel_fb_obj(&ifbdev->fb->base)) {
> +	    if (state == FBINFO_STATE_RUNNING &&
> 
> -:19: WARNING:TABSTOP: Statements should start on a tabstop
> #19: FILE: drivers/gpu/drm/i915/display/intel_fbdev.c:599:
> +	    if (state == FBINFO_STATE_RUNNING &&
> 
> -:20: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open
> parenthesis
> #20: FILE: drivers/gpu/drm/i915/display/intel_fbdev.c:600:
> +	    if (state == FBINFO_STATE_RUNNING &&
> +		    intel_fb_obj(&ifbdev->fb->base)->stolen)
> 
> -:25: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
> 
> total: 1 errors, 3 warnings, 1 checks, 13 lines checked
> f2f5b020a8e8 Critical KlockWork Error - Fixes - intel_display.c - Possible
> NullPointerDereference1
> -:9: WARNING:COMMIT_MESSAGE: Missing commit description - Add an
> appropriate one
> 
> -:19: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional
> statements (8, 12)
> #19: FILE: drivers/gpu/drm/i915/display/intel_display.c:2268:
> +	if (obj)
> +	    vma = i915_gem_object_pin_to_display_plane(obj,
> 
> -:21: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open
> parenthesis
> #21: FILE: drivers/gpu/drm/i915/display/intel_display.c:2270:
> +	    vma = i915_gem_object_pin_to_display_plane(obj,
> +		    alignment, view, pinctl);
> 
> -:24: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
> 
> total: 1 errors, 2 warnings, 1 checks, 12 lines checked ad3c9fa781ce Critical
> KlockWork Error - Fixes - intel_sdvo.c - Possible NullPointerDereference1
> -:9: WARNING:COMMIT_MESSAGE: Missing commit description - Add an
> appropriate one
> 
> -:16: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional
> statements (8, 12)
> #16: FILE: drivers/gpu/drm/i915/display/intel_sdvo.c:2508:
> +	if (!(new_conn_state && old_conn_state && old_state && new_state))
> +	    return 0;
> 
> -:17: WARNING:TABSTOP: Statements should start on a tabstop
> #17: FILE: drivers/gpu/drm/i915/display/intel_sdvo.c:2509:
> +	    return 0;
> 
> -:21: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
> 
> total: 1 errors, 3 warnings, 0 checks, 9 lines checked
> 35e611290838 Critical KlockWork Error - Fixes - intel_tv.c - Possible
> NullPointerDereference1
> -:9: WARNING:COMMIT_MESSAGE: Missing commit description - Add an
> appropriate one
> 
> -:21: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional
> statements (8, 12)
> #21: FILE: drivers/gpu/drm/i915/display/intel_tv.c:1845:
> +	if (old_state && new_state && new_crtc_state) {
> [...]
> +	    if (old_state->tv.mode != new_state->tv.mode ||
> 
> -:22: CHECK:BRACES: Blank lines aren't necessary after an open brace '{'
> #22: FILE: drivers/gpu/drm/i915/display/intel_tv.c:1846:
> +	if (old_state && new_state && new_crtc_state) {
> +
> 
> -:23: WARNING:TABSTOP: Statements should start on a tabstop
> #23: FILE: drivers/gpu/drm/i915/display/intel_tv.c:1847:
> +	    if (old_state->tv.mode != new_state->tv.mode ||
> 
> -:24: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open
> parenthesis
> #24: FILE: drivers/gpu/drm/i915/display/intel_tv.c:1848:
> +	    if (old_state->tv.mode != new_state->tv.mode ||
> +		    old_state->tv.margins.left != new_state->tv.margins.left ||
> 
> -:31: WARNING:TABSTOP: Statements should start on a tabstop
> #31: FILE: drivers/gpu/drm/i915/display/intel_tv.c:1855:
> +	    }
> 
> -:34: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
> 
> total: 1 errors, 4 warnings, 2 checks, 22 lines checked
> b91c796bdad7 Critical KlockWork Error - Fixes - intel_display_power.c - Possible
> NullPointerDereference2
> -:9: WARNING:COMMIT_MESSAGE: Missing commit description - Add an
> appropriate one
> 
> -:16: ERROR:TRAILING_WHITESPACE: trailing whitespace
> #16: FILE: drivers/gpu/drm/i915/display/intel_display_power.c:604:
> +^Iif (!dig_port) $
> 
> -:16: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional
> statements (8, 12)
> #16: FILE: drivers/gpu/drm/i915/display/intel_display_power.c:604:
> +	if (!dig_port)
> +	    return;
> 
> -:17: WARNING:TABSTOP: Statements should start on a tabstop
> #17: FILE: drivers/gpu/drm/i915/display/intel_display_power.c:605:
> +	    return;
> 
> -:21: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
> 
> total: 2 errors, 3 warnings, 0 checks, 9 lines checked aae7f8d354af Critical
> KlockWork Error - Fixes - intel_combo_phy.c Uninitialized Variable-1
> -:9: WARNING:COMMIT_MESSAGE: Missing commit description - Add an
> appropriate one
> 
> -:20: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)
> 
> total: 1 errors, 1 warnings, 0 checks, 8 lines checked
> 
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Shankar, Uma Aug. 14, 2020, 1:39 p.m. UTC | #2
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Nischal
> Varide
> Sent: Friday, August 14, 2020 8:20 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Varide, Nischal <nischal.varide@intel.com>
> Subject: [Intel-gfx] [PATCH 1/8] Critical KlockWork Error - Fixes - intel_cdclk.c -
> Possible NullPointerDereference1

Add some commit description explaining the clockwork warning.

Also append all display patches (in display folder) with "drm/i915/display :"
in the commit headers. For generic path have "drm/i915:" as prefix.
Please check the format used in patches already merged to tree.

> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c
> b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index 9d6cacbdb691..1cd0ab5b36d2 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -1926,7 +1926,11 @@ intel_set_cdclk_pre_plane_update(struct
> intel_atomic_state *state)
>  		intel_atomic_get_old_cdclk_state(state);
>  	const struct intel_cdclk_state *new_cdclk_state =
>  		intel_atomic_get_new_cdclk_state(state);
> -	enum pipe pipe = new_cdclk_state->pipe;
> +	enum pipe pipe;
> +
> +	if (!(old_cdclk_state && new_cdclk_state))
> +		return
> +	(void)(pipe = new_cdclk_state->pipe);

Is this typecast really needed ?

> 
>  	if (!intel_cdclk_changed(&old_cdclk_state->actual,
>  				 &new_cdclk_state->actual))
> @@ -1955,7 +1959,13 @@ intel_set_cdclk_post_plane_update(struct
> intel_atomic_state *state)
>  		intel_atomic_get_old_cdclk_state(state);
>  	const struct intel_cdclk_state *new_cdclk_state =
>  		intel_atomic_get_new_cdclk_state(state);
> -	enum pipe pipe = new_cdclk_state->pipe;
> +	enum pipe pipe;
> +
> +	if (!(old_cdclk_state && new_cdclk_state))
> +		return
> +	(void)(pipe = new_cdclk_state->pipe);

Same here.

> +
> +
> 
>  	if (!intel_cdclk_changed(&old_cdclk_state->actual,
>  				 &new_cdclk_state->actual))
> @@ -2484,6 +2494,9 @@ int intel_modeset_calc_cdclk(struct intel_atomic_state
> *state)
> 
>  	old_cdclk_state = intel_atomic_get_old_cdclk_state(state);
> 
> +	if (!(old_cdclk_state && new_cdclk_state))
> +		return
> +
>  	new_cdclk_state->active_pipes =
>  		intel_calc_active_pipes(state, old_cdclk_state->active_pipes);
> 
> --
> 2.26.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 9d6cacbdb691..1cd0ab5b36d2 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -1926,7 +1926,11 @@  intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
 		intel_atomic_get_old_cdclk_state(state);
 	const struct intel_cdclk_state *new_cdclk_state =
 		intel_atomic_get_new_cdclk_state(state);
-	enum pipe pipe = new_cdclk_state->pipe;
+	enum pipe pipe;
+
+	if (!(old_cdclk_state && new_cdclk_state))
+		return
+	(void)(pipe = new_cdclk_state->pipe);
 
 	if (!intel_cdclk_changed(&old_cdclk_state->actual,
 				 &new_cdclk_state->actual))
@@ -1955,7 +1959,13 @@  intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)
 		intel_atomic_get_old_cdclk_state(state);
 	const struct intel_cdclk_state *new_cdclk_state =
 		intel_atomic_get_new_cdclk_state(state);
-	enum pipe pipe = new_cdclk_state->pipe;
+	enum pipe pipe;
+
+	if (!(old_cdclk_state && new_cdclk_state))
+		return
+	(void)(pipe = new_cdclk_state->pipe);
+
+
 
 	if (!intel_cdclk_changed(&old_cdclk_state->actual,
 				 &new_cdclk_state->actual))
@@ -2484,6 +2494,9 @@  int intel_modeset_calc_cdclk(struct intel_atomic_state *state)
 
 	old_cdclk_state = intel_atomic_get_old_cdclk_state(state);
 
+	if (!(old_cdclk_state && new_cdclk_state))
+		return
+
 	new_cdclk_state->active_pipes =
 		intel_calc_active_pipes(state, old_cdclk_state->active_pipes);