Skip to content

Commit

Permalink
mwifiex: sdio: don't check for NULL sdio_func
Browse files Browse the repository at this point in the history
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: Brian Norris <briannorris@chromium.org>
Tested-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Brian Norris authored and Kalle Valo committed Nov 19, 2016
1 parent 58b7033 commit 6caf34c
Showing 1 changed file with 15 additions and 25 deletions.
40 changes: 15 additions & 25 deletions drivers/net/wireless/marvell/mwifiex/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,10 @@ static int mwifiex_sdio_resume(struct device *dev)
struct mwifiex_adapter *adapter;
mmc_pm_flag_t pm_flag = 0;

if (func) {
pm_flag = sdio_get_host_pm_caps(func);
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
pr_err("resume: invalid card or adapter\n");
return 0;
}
} else {
pr_err("resume: sdio_func is not specified\n");
pm_flag = sdio_get_host_pm_caps(func);
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
dev_err(dev, "resume: invalid card or adapter\n");
return 0;
}

Expand Down Expand Up @@ -272,23 +267,18 @@ static int mwifiex_sdio_suspend(struct device *dev)
mmc_pm_flag_t pm_flag = 0;
int ret = 0;

if (func) {
pm_flag = sdio_get_host_pm_caps(func);
pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
sdio_func_id(func), pm_flag);
if (!(pm_flag & MMC_PM_KEEP_POWER)) {
pr_err("%s: cannot remain alive while host is"
" suspended\n", sdio_func_id(func));
return -ENOSYS;
}
pm_flag = sdio_get_host_pm_caps(func);
pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
sdio_func_id(func), pm_flag);
if (!(pm_flag & MMC_PM_KEEP_POWER)) {
dev_err(dev, "%s: cannot remain alive while host is"
" suspended\n", sdio_func_id(func));
return -ENOSYS;
}

card = sdio_get_drvdata(func);
if (!card) {
dev_err(dev, "suspend: invalid card\n");
return 0;
}
} else {
pr_err("suspend: sdio_func is not specified\n");
card = sdio_get_drvdata(func);
if (!card) {
dev_err(dev, "suspend: invalid card\n");
return 0;
}

Expand Down

0 comments on commit 6caf34c

Please sign in to comment.