mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
emmc: clean the coverity errors for emmc module.
PD#170176: code defects in emmc part. Change-Id: I2fbdb03d20bb1ea8087453398a3bc3731b30b466 Signed-off-by: Qiang Li <qiang.li@amlogic.com>
This commit is contained in:
@@ -1298,10 +1298,10 @@ int aml_emmc_clktree_init(struct amlsd_host *host)
|
||||
snprintf(name, sizeof(name), "clkin%d", i);
|
||||
host->mux_parent[i] = devm_clk_get(host->dev, name);
|
||||
if (IS_ERR(host->mux_parent[i])) {
|
||||
ret = PTR_ERR(host->mux_parent[i]);
|
||||
if (PTR_ERR(host->mux_parent[i]) != -EPROBE_DEFER)
|
||||
dev_err(host->dev, "Missing clock %s\n", name);
|
||||
host->mux_parent[i] = NULL;
|
||||
ret = PTR_ERR(host->mux_parent[i]);
|
||||
return ret;
|
||||
}
|
||||
host->mux_parent_rate[i] = clk_get_rate(host->mux_parent[i]);
|
||||
@@ -1572,7 +1572,6 @@ static u32 aml_sd_emmc_pre_pio(struct amlsd_host *host,
|
||||
struct mmc_data *data = NULL;
|
||||
u8 direction = 0, data_rw = 0, block_mode, data_num = 0;
|
||||
u32 data_size, data_len, ret = 0;
|
||||
u32 desc_cnt = 0;
|
||||
u32 bl_len;
|
||||
struct sd_emmc_desc_info *desc_cur = NULL;
|
||||
struct cmd_cfg *des_cmd_cur = NULL;
|
||||
@@ -1614,10 +1613,6 @@ static u32 aml_sd_emmc_pre_pio(struct amlsd_host *host,
|
||||
|
||||
desc_cur = desc;
|
||||
des_cmd_cur = (struct cmd_cfg *)&(desc_cur->cmd_info);
|
||||
if (desc_cnt != 0) { /* for first desc, */
|
||||
des_cmd_cur->no_resp = 1;
|
||||
des_cmd_cur->no_cmd = 1;
|
||||
}
|
||||
des_cmd_cur->data_io = 1;
|
||||
des_cmd_cur->owner = 1;
|
||||
des_cmd_cur->timeout = 0xc;
|
||||
@@ -2579,8 +2574,10 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
|
||||
host->xfer_step = XFER_IRQ_TASKLET_BUSY;
|
||||
else
|
||||
host->xfer_step = XFER_IRQ_OCCUR;
|
||||
} else {
|
||||
spin_unlock_irqrestore(&host->mrq_lock, flags);
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
/* ack all (enabled) interrupts */
|
||||
writel(0x7fff, host->base + SD_EMMC_STATUS);
|
||||
spin_unlock_irqrestore(&host->mrq_lock, flags);
|
||||
@@ -2707,12 +2704,9 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
|
||||
|
||||
if (!mrq) {
|
||||
pr_err("%s: !mrq xfer_step %d\n",
|
||||
mmc_hostname(host->mmc), xfer_step);
|
||||
if (xfer_step == XFER_FINISHED ||
|
||||
xfer_step == XFER_TIMER_TIMEOUT){
|
||||
spin_unlock_irqrestore(&host->mrq_lock, flags);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
mmc_hostname(host->mmc), xfer_step);
|
||||
spin_unlock_irqrestore(&host->mrq_lock, flags);
|
||||
return IRQ_HANDLED;
|
||||
/* aml_sd_emmc_print_err(host);*/
|
||||
}
|
||||
|
||||
@@ -3040,8 +3034,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
|
||||
|
||||
host = kzalloc(sizeof(struct amlsd_host), GFP_KERNEL);
|
||||
if (!host)
|
||||
ret = -ENODEV;
|
||||
|
||||
return -ENODEV;
|
||||
host->pdev = pdev;
|
||||
host->dev = &pdev->dev;
|
||||
dev_set_drvdata(&pdev->dev, host);
|
||||
@@ -3050,6 +3043,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
|
||||
of_device_get_match_data(&pdev->dev);
|
||||
if (!host->data) {
|
||||
ret = -EINVAL;
|
||||
pr_err("%s() fail!\n", __func__);
|
||||
goto fail_init_host;
|
||||
}
|
||||
if (host->data->chip_type >= MMC_CHIP_TXLX)
|
||||
|
||||
@@ -376,11 +376,8 @@ irqreturn_t meson_mmc_irq_thread_v3(int irq, void *dev_id)
|
||||
if (!mrq) {
|
||||
pr_err("%s: !mrq xfer_step %d\n",
|
||||
mmc_hostname(host->mmc), xfer_step);
|
||||
if (xfer_step == XFER_FINISHED ||
|
||||
xfer_step == XFER_TIMER_TIMEOUT){
|
||||
spin_unlock_irqrestore(&host->mrq_lock, flags);
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
/* aml_sd_emmc_print_err(host); */
|
||||
}
|
||||
/* process stop cmd we sent on porpos */
|
||||
|
||||
@@ -894,7 +894,7 @@ int aml_sd_uart_detect(struct amlsd_platform *pdata)
|
||||
aml_sd_voltage_switch(mmc,
|
||||
MMC_SIGNAL_VOLTAGE_330);
|
||||
|
||||
if (pdata->caps & MMC_CAP_4_BIT_DATA)
|
||||
if (pdata->caps & MMC_CAP_4_BIT_DATA && mmc)
|
||||
mmc->caps |= MMC_CAP_4_BIT_DATA;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -253,8 +253,8 @@ int amlmmc_dtb_write(struct mmc_card *mmc,
|
||||
pr_info("timestamp are not same %d:%d\n",
|
||||
info->stamp[0], info->stamp[1]);
|
||||
dtb->timestamp = 1 +
|
||||
stamp_after(info->stamp[1], info->stamp[0]) ?
|
||||
info->stamp[1]:info->stamp[0];
|
||||
(stamp_after(info->stamp[1], info->stamp[0]) ?
|
||||
info->stamp[1]:info->stamp[0]);
|
||||
} else
|
||||
dtb->timestamp = 1 + info->stamp[0];
|
||||
}
|
||||
@@ -293,10 +293,6 @@ int amlmmc_dtb_read(struct mmc_card *card,
|
||||
memset(buf, 0x0, len);
|
||||
|
||||
start_blk = MMC_DTB_PART_OFFSET;
|
||||
if (start_blk < 0) {
|
||||
ret = -EINVAL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
pgcnt = PAGE_ALIGN(CONFIG_DTB_SIZE) >> PAGE_SHIFT;
|
||||
|
||||
@@ -988,7 +984,7 @@ static int add_emmc_partition(struct gendisk *disk,
|
||||
pr_info("[%s] %s: partition exceeds device capacity:\n",
|
||||
__func__, disk->disk_name);
|
||||
|
||||
pr_info("\%20s offset 0x%012llx, size 0x%012llx\n",
|
||||
pr_info("%20s offset 0x%012llx, size 0x%012llx\n",
|
||||
pp->name, offset<<9, size<<9);
|
||||
|
||||
break;
|
||||
@@ -1233,7 +1229,10 @@ int aml_emmc_partition_ops(struct mmc_card *card, struct gendisk *disk)
|
||||
|
||||
if (ret == 0) /* ok */
|
||||
ret = emmc_key_init(card);
|
||||
|
||||
if (ret) {
|
||||
kfree(pt_fmt);
|
||||
goto out;
|
||||
}
|
||||
amlmmc_dtb_init(card);
|
||||
|
||||
aml_store_class = class_create(THIS_MODULE, "aml_store");
|
||||
|
||||
@@ -229,7 +229,7 @@ enum mmc_blk_status {
|
||||
#define MMC_NUM_BOOT_PARTITION 2
|
||||
#define MMC_NUM_GP_PARTITION 4
|
||||
#define MMC_NUM_PHY_PARTITION 7
|
||||
#define MAX_MMC_PART_NAME_LEN 20
|
||||
#define MAX_MMC_PART_NAME_LEN 16
|
||||
|
||||
/*
|
||||
* MMC Physical partitions
|
||||
|
||||
Reference in New Issue
Block a user