diff mbox series

[1/5] Critical-KclockWork-Fixes-intel_atomi.c-PossibleNull

Message ID 20200819043409.26010-1-nischal.varide@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/5] Critical-KclockWork-Fixes-intel_atomi.c-PossibleNull | expand

Commit Message

Nischal Varide Aug. 19, 2020, 4:34 a.m. UTC
This Patch fixes the Klocwork errors and the Current fix is avoiding
Possible Null Pointer Dereference

Signed-off-by: Nischal Varide <nischal.varide@intel.com>
---
 drivers/gpu/drm/i915/display/intel_atomic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

kernel test robot Aug. 19, 2020, 6:47 p.m. UTC | #1
Hi Nischal,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v5.9-rc1 next-20200819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nischal-Varide/Critical-KclockWork-Fixes-intel_atomi-c-PossibleNull/20200819-193249
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-c001-20200818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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


coccinelle warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/i915/display/intel_atomic.c:199:9-10: WARNING: return of 0/1 in function 'intel_connector_needs_modeset' with return type bool

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c
index 630f49b7aa01..cf51f1005ec1 100644
--- a/drivers/gpu/drm/i915/display/intel_atomic.c
+++ b/drivers/gpu/drm/i915/display/intel_atomic.c
@@ -132,6 +132,9 @@  int intel_digital_connector_atomic_check(struct drm_connector *conn,
 		to_intel_digital_connector_state(old_state);
 	struct drm_crtc_state *crtc_state;
 
+	if (!(new_state && new_conn_state && old_state && old_conn_state))
+		return 0;
+
 	intel_hdcp_atomic_check(conn, old_state, new_state);
 	intel_psr_atomic_check(conn, old_state, new_state);
 
@@ -192,6 +195,8 @@  intel_connector_needs_modeset(struct intel_atomic_state *state,
 
 	old_conn_state = drm_atomic_get_old_connector_state(&state->base, connector);
 	new_conn_state = drm_atomic_get_new_connector_state(&state->base, connector);
+	if (!(old_conn_state && new_conn_state))
+		return 0;
 
 	return old_conn_state->crtc != new_conn_state->crtc ||
 	       (new_conn_state->crtc &&
@@ -418,7 +423,7 @@  int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv,
 	 */
 
 	/* fail if required scalers > available scalers */
-	if (num_scalers_need > intel_crtc->num_scalers){
+	if (num_scalers_need > intel_crtc->num_scalers) {
 		drm_dbg_kms(&dev_priv->drm,
 			    "Too many scaling requests %d > %d\n",
 			    num_scalers_need, intel_crtc->num_scalers);