Skip to content

Commit 953898c

Browse files
claudiubezneacristibirsan
authored andcommitted
staging: wilc1000: call autosuspend in case of failure
Call pm_runtime_put_sync_autosuspend() on error path in wilc_sdio_init(). The resume operation was handled by pm_runtime_get_sync(). Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent 537913e commit 953898c

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

  • drivers/staging/wilc1000

drivers/staging/wilc1000/sdio.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
674674
ret = wilc_sdio_cmd52(wilc, &cmd);
675675
if (ret) {
676676
dev_err(&func->dev, "Fail cmd 52, enable csa...\n");
677-
return ret;
677+
goto pm_runtime_put;
678678
}
679679

680680
/**
@@ -683,7 +683,7 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
683683
ret = wilc_sdio_set_block_size(wilc, 0, WILC_SDIO_BLOCK_SIZE);
684684
if (ret) {
685685
dev_err(&func->dev, "Fail cmd 52, set func 0 block size...\n");
686-
return ret;
686+
goto pm_runtime_put;
687687
}
688688
sdio_priv->block_size = WILC_SDIO_BLOCK_SIZE;
689689

@@ -699,7 +699,7 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
699699
if (ret) {
700700
dev_err(&func->dev,
701701
"Fail cmd 52, set IOE register...\n");
702-
return ret;
702+
goto pm_runtime_put;
703703
}
704704

705705
/**
@@ -716,15 +716,15 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
716716
if (ret) {
717717
dev_err(&func->dev,
718718
"Fail cmd 52, get IOR register...\n");
719-
return ret;
719+
goto pm_runtime_put;
720720
}
721721
if (cmd.data == WILC_SDIO_CCCR_IO_EN_FUNC1)
722722
break;
723723
} while (loop--);
724724

725725
if (loop <= 0) {
726726
dev_err(&func->dev, "Fail func 1 is not ready...\n");
727-
return ret;
727+
goto pm_runtime_put;
728728
}
729729

730730
/**
@@ -733,7 +733,7 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
733733
ret = wilc_sdio_set_block_size(wilc, 1, WILC_SDIO_BLOCK_SIZE);
734734
if (ret) {
735735
dev_err(&func->dev, "Fail set func 1 block size...\n");
736-
return ret;
736+
goto pm_runtime_put;
737737
}
738738

739739
/**
@@ -747,7 +747,7 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
747747
ret = wilc_sdio_cmd52(wilc, &cmd);
748748
if (ret) {
749749
dev_err(&func->dev, "Fail cmd 52, set IEN register...\n");
750-
return ret;
750+
goto pm_runtime_put;
751751
}
752752

753753
/**
@@ -761,14 +761,18 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
761761
wilc->chip = WILC_1000;
762762
} else {
763763
dev_err(&func->dev, "Unsupported chipid: %x\n", chipid);
764-
return -EINVAL;
764+
goto pm_runtime_put;
765765
}
766766
dev_info(&func->dev, "chipid %08x\n", chipid);
767767
}
768768

769769
sdio_priv->is_init = true;
770770

771771
return 0;
772+
773+
pm_runtime_put:
774+
pm_runtime_put_sync_autosuspend(mmc_dev(func->card->host));
775+
return ret;
772776
}
773777

774778
static int wilc_sdio_read_size(struct wilc *wilc, u32 *size)

0 commit comments

Comments
 (0)