staging: mt7621-mmc: Fix dereference before check in msdc_drv_pm

In the msdc_drv_pm function the variable mmc is dereferenced before
checked. Reordering fixes that.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Christian Lütke-Stetzkamp 2018-04-24 20:01:22 +02:00 committed by Greg Kroah-Hartman
parent 7cc6f682ca
commit afcc0ca1c8
1 changed files with 3 additions and 3 deletions

View File

@ -2709,10 +2709,10 @@ static int msdc_drv_remove(struct platform_device *pdev)
static void msdc_drv_pm(struct platform_device *pdev, pm_message state)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct msdc_host *host = mmc_priv(mmc);
if (mmc)
if (mmc) {
struct msdc_host *host = mmc_priv(mmc);
msdc_pm(state, (void *)host);
}
}
static int msdc_drv_suspend(struct platform_device *pdev, pm_message_t state)