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

Commit 053755ed authored by Bao D. Nguyen's avatar Bao D. Nguyen
Browse files

mmc: core: Fix clock scaling's init error checking



The SD card's clock scaling initialization code fails to error
check the error pointer returned from the registration with the
devfreq framework. As a result, a possible failure to register with
the devfreq framework may not be reported in a timely manner,
resulting in the SD card clock scaling feature failure later on
when it is accessed.

Change-Id: I6995d98d4f4539aa7f5f2d73eb3aafcc96ec5cf6
Signed-off-by: default avatarBao D. Nguyen <nguyenb@codeaurora.org>
parent 03cafa97
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -708,6 +708,7 @@ static int mmc_devfreq_create_freq_table(struct mmc_host *host)
int mmc_init_clk_scaling(struct mmc_host *host)
{
	int err;
	struct devfreq *devfreq;

	if (!host || !host->card) {
		pr_err("%s: unexpected host/card parameters\n",
@@ -763,17 +764,20 @@ int mmc_init_clk_scaling(struct mmc_host *host)
		host->clk_scaling.ondemand_gov_data.upthreshold,
		host->clk_scaling.ondemand_gov_data.downdifferential,
		host->clk_scaling.devfreq_profile.polling_ms);
	host->clk_scaling.devfreq = devfreq_add_device(

	devfreq = devfreq_add_device(
		mmc_classdev(host),
		&host->clk_scaling.devfreq_profile,
		"simple_ondemand",
		&host->clk_scaling.ondemand_gov_data);
	if (!host->clk_scaling.devfreq) {

	if (IS_ERR(devfreq)) {
		pr_err("%s: unable to register with devfreq\n",
			mmc_hostname(host));
		return -EPERM;
		return PTR_ERR(devfreq);
	}

	host->clk_scaling.devfreq = devfreq;
	pr_debug("%s: clk scaling is enabled for device %s (%p) with devfreq %p (clock = %uHz)\n",
		mmc_hostname(host),
		dev_name(mmc_classdev(host)),