diff --git a/drivers/mtd/hisilicon/sfc/hrd_sfc_driver.c b/drivers/mtd/hisilicon/sfc/hrd_sfc_driver.c index 732cb5f1b11e20e53e8c814b8f1e33f4c9213717..36796270d5bfba6c4a048e0cac9ee1d6ec168a96 100644 --- a/drivers/mtd/hisilicon/sfc/hrd_sfc_driver.c +++ b/drivers/mtd/hisilicon/sfc/hrd_sfc_driver.c @@ -27,9 +27,8 @@ #include #include "hrdCommon.h" #include "hrd_sflash_driver.h" -#include "hrd_sflash_hal.h" -#define SFC_DRIVER_VERSION "1.7.8.0" +#define SFC_DRIVER_VERSION "1.7.9.0" static const char *sflashMtdList[] = { "sflash", NULL }; @@ -147,6 +146,10 @@ static unsigned int flash_map_init(struct platform_device *pdev) sfc_regres = platform_get_resource(pdev, IORESOURCE_MEM, 0); flash_iores = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (!sfc_regres || !flash_iores) { + return -EFAULT; + } + if (sfc_regres->end <= sfc_regres->start) { pr_err("ERROR: sfc register error\n"); return -EFAULT; @@ -193,7 +196,6 @@ static void __exit flash_map_exit(struct platform_device *pdev) for (i = 0; i < host->mapsNum; i++) { if (host->maps[i].mtdInfo) { (void)mtd_device_unregister(host->maps[i].mtdInfo); - map_destroy(host->maps[i].mtdInfo); } if (host->maps[i].mapInfo.virt) { @@ -201,7 +203,7 @@ static void __exit flash_map_exit(struct platform_device *pdev) host->maps[i].mapInfo.virt = 0; } - if (host->maps[i].mtdInfo) { + if (host->maps[i].mtdInfo) { sflash_destroy(host->maps[i].mtdInfo); } } diff --git a/drivers/mtd/hisilicon/sfc/hrd_sflash_driver.c b/drivers/mtd/hisilicon/sfc/hrd_sflash_driver.c index 636d2c48e6235e983ddf9c09d8b12269874de217..659dbe1eccc3b4dd8160d34a1e8f6b7748b297e9 100644 --- a/drivers/mtd/hisilicon/sfc/hrd_sflash_driver.c +++ b/drivers/mtd/hisilicon/sfc/hrd_sflash_driver.c @@ -164,7 +164,6 @@ struct mtd_info *sflash_probe(struct map_info *map, struct resource *sfc_regres) ((sflash->sectorNumber * sflash->sectorSize) / 1024), sflash->sectorNumber, (sflash->sectorSize / 1024)); - __module_get(THIS_MODULE); return mtd; exit0: diff --git a/drivers/mtd/hisilicon/sfc/hrd_sflash_hal.c b/drivers/mtd/hisilicon/sfc/hrd_sflash_hal.c index 1a2bb3a783dec7ee35d95f3f63d0dcf7727e641c..c30600512db25aaac3d30d88b7524f77d29abc8d 100644 --- a/drivers/mtd/hisilicon/sfc/hrd_sflash_hal.c +++ b/drivers/mtd/hisilicon/sfc/hrd_sflash_hal.c @@ -999,7 +999,7 @@ static s32 SFC_RegWordAlignRead(struct SFC_SFLASH_INFO *sflash, } for (i = 0; i < ulDataCnt; i++) { - pulData[i] = SFC_RegisterRead(sflash->sfc_reg_base + DATABUFFER1 + 4*i); + pulData[i] = SFC_RegisterRead(sflash->sfc_reg_base + DATABUFFER1 + (u32)(4*i)); } return ulRet; @@ -1069,7 +1069,7 @@ static s32 SFC_RegWordAlignWrite(struct SFC_SFLASH_INFO *sflash, ulDataCnt = ulWriteLen>>2; for (i = 0; i < ulDataCnt; i++) { - SFC_RegisterWrite(sflash->sfc_reg_base + DATABUFFER1+4*i, ulData[i]); + SFC_RegisterWrite(sflash->sfc_reg_base + DATABUFFER1 + (u32)(4*i), ulData[i]); } SFC_RegisterWrite(sflash->sfc_reg_base + CMD_ADDR, ulOffsetAddr); diff --git a/drivers/mtd/hisilicon/sfc/lbc.h b/drivers/mtd/hisilicon/sfc/lbc.h deleted file mode 100644 index 4bf1592661e2d147486a98325a578db1862d3302..0000000000000000000000000000000000000000 --- a/drivers/mtd/hisilicon/sfc/lbc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2019 Hisilicon Limited, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see