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

Commit 3c7b269a authored by Pavan Anamula's avatar Pavan Anamula Committed by Kyle Yan
Browse files

drivers: mmc: fix issue raised by source code analyzer tool



Fix the below reported issues by source code analyzer.

1) Pointer 'ext_csd' returned from call to function 'mmc_get_ext_csd'
may be NULL and will be dereferenced at ext_csd[EXT_CSD_CMDQ] in
mmc_test_awake_ext_csd(), causing NUll pointer derefernce.

2) Array 'sdhci_slot' of size 2 may use index value(s) -1 as below,
when ret = 0.

	sdhci_slot[ret-1] = msm_host;

3) Variable 'host->lock' locked ,And was not unlocked when below
condition occurs in sdhci_irq().

	if (!mmc_card_and_host_support_async_int(host->mmc))
		return IRQ_NONE;

CRs-Fixed: 1000387
Change-Id: Iec6ecef1bf940e720c871be58b265394904f0cf1
Signed-off-by: default avatarPavan Anamula <pavana@codeaurora.org>
parent 9ed18dec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2439,7 +2439,7 @@ static int mmc_test_awake_ext_csd(struct mmc_host *host)
	struct mmc_card *card = host->card;

	err = mmc_get_ext_csd(card, &ext_csd);
	if (err) {
	if (err || !ext_csd) {
		pr_err("%s: %s: mmc_get_ext_csd failed (%d)\n",
			mmc_hostname(host), __func__, err);
		return err;
+1 −1
Original line number Diff line number Diff line
@@ -3936,7 +3936,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
	/* Extract platform data */
	if (pdev->dev.of_node) {
		ret = of_alias_get_id(pdev->dev.of_node, "sdhc");
		if (ret < 0) {
		if (ret <= 0) {
			dev_err(&pdev->dev, "Failed to get slot index %d\n",
				ret);
			goto pltfm_free;
+3 −1
Original line number Diff line number Diff line
@@ -3089,8 +3089,10 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)

	if (!host->clock && host->mmc->card &&
			mmc_card_sdio(host->mmc->card)) {
		if (!mmc_card_and_host_support_async_int(host->mmc))
		if (!mmc_card_and_host_support_async_int(host->mmc)) {
			spin_unlock(&host->lock);
			return IRQ_NONE;
		}
		/*
		 * async card interrupt is level sensitive and received
		 * when clocks are off.