On Sun, 2016-08-21 at 22:52 +0200, Heinrich Schuchardt wrote: > It does not make sense to check if table is NULL > and afterwards to dereference it without > considering the result.
This makes no sense. > The inconsistency was indicated by cppcheck. Perhaps this is a defect in cppcheck? > An actual NULL pointer dereference was not observed. [] > diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c [] > @@ -2962,7 +2962,7 @@ static int si_get_vce_clock_voltage(struct > radeon_device *rdev, > Â &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; > Â > Â if (((evclk == 0) && (ecclk == 0)) || > - Â Â Â Â (table && (table->count == 0))) { Here table is only dereferenced if table is non-null > + Â Â Â Â table == NULL || table->count == 0) { > Â *voltage = 0; > Â return 0; > Â } Perhaps the unnecessary parentheses can be reduce though. Â if ((evclk == 0 && ecclk == 0) || (table && table->count == 0)) {