Commit 6caf34cb authored by Brian Norris's avatar Brian Norris Committed by Kalle Valo

mwifiex: sdio: don't check for NULL sdio_func

sdio_func is retrieved via container_of() and should never be NULL.
Checking for NULL just makes the logic more confusing than necessary.
Stop doing that.
Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Tested-by: default avatarXinming Hu <huxm@marvell.com>
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 58b70335
...@@ -188,15 +188,10 @@ static int mwifiex_sdio_resume(struct device *dev) ...@@ -188,15 +188,10 @@ static int mwifiex_sdio_resume(struct device *dev)
struct mwifiex_adapter *adapter; struct mwifiex_adapter *adapter;
mmc_pm_flag_t pm_flag = 0; mmc_pm_flag_t pm_flag = 0;
if (func) { pm_flag = sdio_get_host_pm_caps(func);
pm_flag = sdio_get_host_pm_caps(func); card = sdio_get_drvdata(func);
card = sdio_get_drvdata(func); if (!card || !card->adapter) {
if (!card || !card->adapter) { dev_err(dev, "resume: invalid card or adapter\n");
pr_err("resume: invalid card or adapter\n");
return 0;
}
} else {
pr_err("resume: sdio_func is not specified\n");
return 0; return 0;
} }
...@@ -272,23 +267,18 @@ static int mwifiex_sdio_suspend(struct device *dev) ...@@ -272,23 +267,18 @@ static int mwifiex_sdio_suspend(struct device *dev)
mmc_pm_flag_t pm_flag = 0; mmc_pm_flag_t pm_flag = 0;
int ret = 0; int ret = 0;
if (func) { pm_flag = sdio_get_host_pm_caps(func);
pm_flag = sdio_get_host_pm_caps(func); pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
pr_debug("cmd: %s: suspend: PM flag = 0x%x\n", sdio_func_id(func), pm_flag);
sdio_func_id(func), pm_flag); if (!(pm_flag & MMC_PM_KEEP_POWER)) {
if (!(pm_flag & MMC_PM_KEEP_POWER)) { dev_err(dev, "%s: cannot remain alive while host is"
pr_err("%s: cannot remain alive while host is" " suspended\n", sdio_func_id(func));
" suspended\n", sdio_func_id(func)); return -ENOSYS;
return -ENOSYS; }
}
card = sdio_get_drvdata(func); card = sdio_get_drvdata(func);
if (!card) { if (!card) {
dev_err(dev, "suspend: invalid card\n"); dev_err(dev, "suspend: invalid card\n");
return 0;
}
} else {
pr_err("suspend: sdio_func is not specified\n");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment