Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3df8429b authored by Santosh Mardi's avatar Santosh Mardi Committed by Gerrit - the friendly Code Review server
Browse files

devfreq: check if get_dev_status is implemented before calling it



devfreq governor code calls the devfreq profile's callback
get_dev_status to return the device status. Not all devices
implement this optional callback. Hence check if the callback
is present before accessing it.

Change-Id: I8fe8ff367ccdcb82ad686e47186258c4cd086696
Signed-off-by: default avatarSantosh Mardi <gsantosh@codeaurora.org>
Signed-off-by: default avatarRama Aparna Mallavarapu <aparnam@codeaurora.org>
parent e4f5f922
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -71,6 +71,10 @@ extern int devfreq_update_status(struct devfreq *devfreq, unsigned long freq);

static inline int devfreq_update_stats(struct devfreq *df)
{
	return df->profile->get_dev_status(df->dev.parent, &df->last_status);
	if (df->profile->get_dev_status)
		return df->profile->get_dev_status(df->dev.parent,
							 &df->last_status);
	else
		return -ENODEV;
}
#endif /* _GOVERNOR_H */