Latest commit 63f1e05 Dec 6, 2017
GustavoARSilva and myungjoo PM / devfreq: Fix potential NULL pointer dereference in governor_store
df->governor is being dereferenced before it is null checked,
hence there is a potential null pointer dereference.

Notice that df->governor is being null checked at line 1004:
if (df->governor) {, which implies it might be null.

Fix this by null checking df->governor before dereferencing it.

Addresses-Coverity-ID: 1401988 ("Dereference before null check")
Fixes: bcf23c7 ("PM / devfreq: Fix available_governor sysfs")
Signed-off-by: Gustavo A. R. Silva <>
Reviewed-by: Chanwoo Choi <>
Signed-off-by: MyungJoo Ham <>