Convert 'alloc_obj' family to use the new default GFP_KERNEL argument

This was done entirely with mindless brute force, using

    git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds
2026-02-21 16:37:42 -08:00
parent e19e1b480a
commit bf4afc53b7
6673 changed files with 13013 additions and 13013 deletions

View File

@@ -501,7 +501,7 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
struct mtd_info *mtd;
int i;
mtd = kzalloc_obj(*mtd, GFP_KERNEL);
mtd = kzalloc_obj(*mtd);
if (!mtd)
return NULL;
mtd->priv = map;

View File

@@ -604,7 +604,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
struct mtd_info *mtd;
int i;
mtd = kzalloc_obj(*mtd, GFP_KERNEL);
mtd = kzalloc_obj(*mtd);
if (!mtd)
return NULL;
mtd->priv = map;
@@ -2818,7 +2818,7 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
for (i = 0; i < mtd->numeraseregions; i++)
max_sectors += regions[i].numblocks;
sect = kzalloc_objs(struct ppb_lock, max_sectors, GFP_KERNEL);
sect = kzalloc_objs(struct ppb_lock, max_sectors);
if (!sect)
return -ENOMEM;

View File

@@ -172,7 +172,7 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
int i,j;
unsigned long devsize = (1<<cfi->cfiq->DevSize) * cfi->interleave;
mtd = kzalloc_obj(*mtd, GFP_KERNEL);
mtd = kzalloc_obj(*mtd);
//printk(KERN_DEBUG "number of CFI chips: %d\n", cfi->numchips);
if (!mtd) {

View File

@@ -46,7 +46,7 @@ static struct mtd_info *map_absent_probe(struct map_info *map)
{
struct mtd_info *mtd;
mtd = kzalloc_obj(*mtd, GFP_KERNEL);
mtd = kzalloc_obj(*mtd);
if (!mtd) {
return NULL;
}

View File

@@ -57,7 +57,7 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
#endif
/* OK. It seems to be RAM. */
mtd = kzalloc_obj(*mtd, GFP_KERNEL);
mtd = kzalloc_obj(*mtd);
if (!mtd)
return NULL;

View File

@@ -45,7 +45,7 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
{
struct mtd_info *mtd;
mtd = kzalloc_obj(*mtd, GFP_KERNEL);
mtd = kzalloc_obj(*mtd);
if (!mtd)
return NULL;

View File

@@ -271,7 +271,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size,
if (!devname)
return NULL;
dev = kzalloc_obj(struct block2mtd_dev, GFP_KERNEL);
dev = kzalloc_obj(struct block2mtd_dev);
if (!dev)
return NULL;

View File

@@ -1810,10 +1810,10 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev)
struct mtd_info *mtd;
ret = -ENOMEM;
docg3 = kzalloc_obj(struct docg3, GFP_KERNEL);
docg3 = kzalloc_obj(struct docg3);
if (!docg3)
goto nomem1;
mtd = kzalloc_obj(struct mtd_info, GFP_KERNEL);
mtd = kzalloc_obj(struct mtd_info);
if (!mtd)
goto nomem2;
mtd->priv = docg3;

View File

@@ -117,7 +117,7 @@ static int __init ms02nv_init_one(ulong addr)
int ret = -ENODEV;
/* The module decodes 8MiB of address space. */
mod_res = kzalloc_obj(*mod_res, GFP_KERNEL);
mod_res = kzalloc_obj(*mod_res);
if (!mod_res)
return -ENOMEM;
@@ -138,10 +138,10 @@ static int __init ms02nv_init_one(ulong addr)
}
ret = -ENOMEM;
mtd = kzalloc_obj(*mtd, GFP_KERNEL);
mtd = kzalloc_obj(*mtd);
if (!mtd)
goto err_out_mod_res_rel;
mp = kzalloc_obj(*mp, GFP_KERNEL);
mp = kzalloc_obj(*mp);
if (!mp)
goto err_out_mtd;
@@ -149,7 +149,7 @@ static int __init ms02nv_init_one(ulong addr)
mp->resource.module = mod_res;
/* Firmware's diagnostic NVRAM area. */
diag_res = kzalloc_obj(*diag_res, GFP_KERNEL);
diag_res = kzalloc_obj(*diag_res);
if (!diag_res)
goto err_out_mp;
@@ -162,7 +162,7 @@ static int __init ms02nv_init_one(ulong addr)
mp->resource.diag_ram = diag_res;
/* User-available general-purpose NVRAM area. */
user_res = kzalloc_obj(*user_res, GFP_KERNEL);
user_res = kzalloc_obj(*user_res);
if (!user_res)
goto err_out_diag_res;
@@ -175,7 +175,7 @@ static int __init ms02nv_init_one(ulong addr)
mp->resource.user_ram = user_res;
/* Control and status register. */
csr_res = kzalloc_obj(*csr_res, GFP_KERNEL);
csr_res = kzalloc_obj(*csr_res);
if (!csr_res)
goto err_out_user_res;

View File

@@ -627,7 +627,7 @@ static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages,
char *otp_tag = "";
int err = 0;
priv = kzalloc_obj(*priv, GFP_KERNEL);
priv = kzalloc_obj(*priv);
if (!priv)
return -ENOMEM;

View File

@@ -720,7 +720,7 @@ static int intel_dg_nvm_init_mtd(struct intel_dg_nvm *nvm, struct device *device
nvm->mtd.erasesize = SZ_4K; /* 4K bytes granularity */
nvm->mtd.size = nvm->size;
parts = kzalloc_objs(*parts, nvm->nregions, GFP_KERNEL);
parts = kzalloc_objs(*parts, nvm->nregions);
if (!parts)
return -ENOMEM;

View File

@@ -158,7 +158,7 @@ static int __init init_mtdram(void)
return -EINVAL;
/* Allocate some memory */
mtd_info = kmalloc_obj(struct mtd_info, GFP_KERNEL);
mtd_info = kmalloc_obj(struct mtd_info);
if (!mtd_info)
return -ENOMEM;

View File

@@ -130,7 +130,7 @@ static int register_device(struct platform_device *pdev, const char *name,
struct phram_mtd_list *new;
int ret = -ENOMEM;
new = kzalloc_obj(*new, GFP_KERNEL);
new = kzalloc_obj(*new);
if (!new)
goto out0;

View File

@@ -715,11 +715,11 @@ static int __init init_pmc551(void)
msize = length;
}
mtd = kzalloc_obj(struct mtd_info, GFP_KERNEL);
mtd = kzalloc_obj(struct mtd_info);
if (!mtd)
break;
priv = kzalloc_obj(struct mypriv, GFP_KERNEL);
priv = kzalloc_obj(struct mypriv);
if (!priv) {
kfree(mtd);
break;

View File

@@ -135,17 +135,17 @@ static int register_device(char *name, unsigned long start, unsigned long length
curmtd = &(*curmtd)->next;
}
*curmtd = kmalloc_obj(slram_mtd_list_t, GFP_KERNEL);
*curmtd = kmalloc_obj(slram_mtd_list_t);
if (!(*curmtd)) {
E("slram: Cannot allocate new MTD device.\n");
return(-ENOMEM);
}
(*curmtd)->mtdinfo = kzalloc_obj(struct mtd_info, GFP_KERNEL);
(*curmtd)->mtdinfo = kzalloc_obj(struct mtd_info);
(*curmtd)->next = NULL;
if ((*curmtd)->mtdinfo) {
(*curmtd)->mtdinfo->priv =
kzalloc_obj(slram_priv_t, GFP_KERNEL);
kzalloc_obj(slram_priv_t);
if (!(*curmtd)->mtdinfo->priv) {
kfree((*curmtd)->mtdinfo);

View File

@@ -201,7 +201,7 @@ static int build_maps(partition_t *part)
/* Set up erase unit maps */
part->DataUnits = le16_to_cpu(part->header.NumEraseUnits) -
part->header.NumTransferUnits;
part->EUNInfo = kmalloc_objs(struct eun_info_t, part->DataUnits, GFP_KERNEL);
part->EUNInfo = kmalloc_objs(struct eun_info_t, part->DataUnits);
if (!part->EUNInfo)
goto out;
for (i = 0; i < part->DataUnits; i++)
@@ -337,7 +337,7 @@ static int erase_xfer(partition_t *part,
/* Is there a free erase slot? Always in MTD. */
erase=kmalloc_obj(struct erase_info, GFP_KERNEL);
erase=kmalloc_obj(struct erase_info);
if (!erase)
return -ENOMEM;
@@ -1005,7 +1005,7 @@ static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
{
partition_t *partition;
partition = kzalloc_obj(partition_t, GFP_KERNEL);
partition = kzalloc_obj(partition_t);
if (!partition) {
printk(KERN_WARNING "No memory to scan for FTL on %s\n",

View File

@@ -52,7 +52,7 @@ static void inftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
pr_debug("INFTL: add_mtd for %s\n", mtd->name);
inftl = kzalloc_obj(*inftl, GFP_KERNEL);
inftl = kzalloc_obj(*inftl);
if (!inftl)
return;

View File

@@ -41,7 +41,7 @@ struct mtd_info *lpddr_cmdset(struct map_info *map)
int numchips;
int i, j;
mtd = kzalloc_obj(*mtd, GFP_KERNEL);
mtd = kzalloc_obj(*mtd);
if (!mtd)
return NULL;
mtd->priv = map;
@@ -65,7 +65,7 @@ struct mtd_info *lpddr_cmdset(struct map_info *map)
mtd->erasesize = 1 << lpddr->qinfo->UniformBlockSizeShift;
mtd->writesize = 1 << lpddr->qinfo->BufSizeShift;
shared = kmalloc_objs(struct flchip_shared, lpddr->numchips, GFP_KERNEL);
shared = kmalloc_objs(struct flchip_shared, lpddr->numchips);
if (!shared) {
kfree(mtd);
return NULL;

View File

@@ -120,7 +120,7 @@ out:
static int lpddr_chip_setup(struct map_info *map, struct lpddr_private *lpddr)
{
lpddr->qinfo = kzalloc_obj(struct qinfo_chip, GFP_KERNEL);
lpddr->qinfo = kzalloc_obj(struct qinfo_chip);
if (!lpddr->qinfo)
return 0;

View File

@@ -188,7 +188,7 @@ static int amd76xrom_init_one(struct pci_dev *pdev,
int i;
if (!map) {
map = kmalloc_obj(*map, GFP_KERNEL);
map = kmalloc_obj(*map);
if (!map)
goto out;
}

View File

@@ -218,7 +218,7 @@ static int __init ck804xrom_init_one(struct pci_dev *pdev,
int i;
if (!map) {
map = kmalloc_obj(*map, GFP_KERNEL);
map = kmalloc_obj(*map);
if (!map)
goto out;
}

View File

@@ -278,7 +278,7 @@ static int __init esb2rom_init_one(struct pci_dev *pdev,
int i;
if (!map) {
map = kmalloc_obj(*map, GFP_KERNEL);
map = kmalloc_obj(*map);
if (!map)
goto out;
}

View File

@@ -212,7 +212,7 @@ static int __init ichxrom_init_one(struct pci_dev *pdev,
int i;
if (!map) {
map = kmalloc_obj(*map, GFP_KERNEL);
map = kmalloc_obj(*map);
if (!map)
goto out;
}

View File

@@ -264,7 +264,7 @@ static int mtd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (err)
goto out;
map = kmalloc_obj(*map, GFP_KERNEL);
map = kmalloc_obj(*map);
err = -ENOMEM;
if (!map)
goto release;

View File

@@ -674,7 +674,7 @@ static int pcmciamtd_probe(struct pcmcia_device *link)
struct pcmciamtd_dev *dev;
/* Create new memory card device */
dev = kzalloc_obj(*dev, GFP_KERNEL);
dev = kzalloc_obj(*dev);
if (!dev) return -ENOMEM;
pr_debug("dev=0x%p\n", dev);

View File

@@ -218,7 +218,7 @@ static int pismo_probe(struct i2c_client *client)
return -EIO;
}
pismo = kzalloc_obj(*pismo, GFP_KERNEL);
pismo = kzalloc_obj(*pismo);
if (!pismo)
return -ENOMEM;

View File

@@ -109,7 +109,7 @@ static int platram_probe(struct platform_device *pdev)
pdata = dev_get_platdata(&pdev->dev);
info = kzalloc_obj(*info, GFP_KERNEL);
info = kzalloc_obj(*info);
if (info == NULL) {
err = -ENOMEM;
goto exit_error;

View File

@@ -51,7 +51,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
if (!res)
return -ENODEV;
info = kzalloc_obj(struct pxa2xx_flash_info, GFP_KERNEL);
info = kzalloc_obj(struct pxa2xx_flash_info);
if (!info)
return -ENOMEM;

View File

@@ -222,7 +222,7 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev,
} else if (info->num_subdev > 1) {
struct mtd_info **cdev;
cdev = kmalloc_objs(*cdev, nr, GFP_KERNEL);
cdev = kmalloc_objs(*cdev, nr);
if (!cdev) {
ret = -ENOMEM;
goto err;

View File

@@ -61,7 +61,7 @@ static int uflash_devinit(struct platform_device *op, struct device_node *dp)
return -ENODEV;
}
up = kzalloc_obj(struct uflash_dev, GFP_KERNEL);
up = kzalloc_obj(struct uflash_dev);
if (!up)
return -ENOMEM;

View File

@@ -73,7 +73,7 @@ static struct vmu_block *ofs_to_block(unsigned long src_ofs,
if (num > card->parts[partition].numblocks)
goto failed;
vblock = kmalloc_obj(struct vmu_block, GFP_KERNEL);
vblock = kmalloc_obj(struct vmu_block);
if (!vblock)
goto failed;
@@ -539,7 +539,7 @@ static void vmu_queryblocks(struct mapleq *mq)
mtd_cur->_sync = vmu_flash_sync;
mtd_cur->writesize = card->blocklen;
mpart = kmalloc_obj(struct mdev_part, GFP_KERNEL);
mpart = kmalloc_obj(struct mdev_part);
if (!mpart)
goto fail_mpart;
@@ -548,7 +548,7 @@ static void vmu_queryblocks(struct mapleq *mq)
mtd_cur->priv = mpart;
mtd_cur->owner = THIS_MODULE;
pcache = kzalloc_obj(struct vmu_cache, GFP_KERNEL);
pcache = kzalloc_obj(struct vmu_cache);
if (!pcache)
goto fail_cache_create;
part_cur->pcache = pcache;
@@ -609,7 +609,7 @@ static int vmu_connect(struct maple_device *mdev)
basic_flash_data = be32_to_cpu(mdev->devinfo.function_data[c - 1]);
card = kmalloc_obj(struct memcard, GFP_KERNEL);
card = kmalloc_obj(struct memcard);
if (!card) {
error = -ENOMEM;
goto fail_nomem;
@@ -627,13 +627,13 @@ static int vmu_connect(struct maple_device *mdev)
* Not sure there are actually any multi-partition devices in the
* real world, but the hardware supports them, so, so will we
*/
card->parts = kmalloc_objs(struct vmupart, card->partitions, GFP_KERNEL);
card->parts = kmalloc_objs(struct vmupart, card->partitions);
if (!card->parts) {
error = -ENOMEM;
goto fail_partitions;
}
card->mtd = kmalloc_objs(struct mtd_info, card->partitions, GFP_KERNEL);
card->mtd = kmalloc_objs(struct mtd_info, card->partitions);
if (!card->mtd) {
error = -ENOMEM;
goto fail_mtd_info;

View File

@@ -324,7 +324,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
new->readonly = 1;
ret = -ENOMEM;
new->tag_set = kzalloc_obj(*new->tag_set, GFP_KERNEL);
new->tag_set = kzalloc_obj(*new->tag_set);
if (!new->tag_set)
goto out_list_del;

View File

@@ -316,7 +316,7 @@ static int mtdblock_flush(struct mtd_blktrans_dev *dev)
static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
{
struct mtdblk_dev *dev = kzalloc_obj(*dev, GFP_KERNEL);
struct mtdblk_dev *dev = kzalloc_obj(*dev);
if (!dev)
return;

View File

@@ -36,7 +36,7 @@ static int mtdblock_writesect(struct mtd_blktrans_dev *dev,
static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
{
struct mtd_blktrans_dev *dev = kzalloc_obj(*dev, GFP_KERNEL);
struct mtd_blktrans_dev *dev = kzalloc_obj(*dev);
if (!dev)
return;

View File

@@ -72,7 +72,7 @@ static int mtdchar_open(struct inode *inode, struct file *file)
goto out1;
}
mfi = kzalloc_obj(*mfi, GFP_KERNEL);
mfi = kzalloc_obj(*mfi);
if (!mfi) {
ret = -ENOMEM;
goto out1;
@@ -923,7 +923,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
{
struct erase_info *erase;
erase=kzalloc_obj(struct erase_info, GFP_KERNEL);
erase=kzalloc_obj(struct erase_info);
if (!erase)
ret = -ENOMEM;
else {
@@ -1162,7 +1162,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
if (!master->ooblayout)
return -EOPNOTSUPP;
usrlay = kmalloc_obj(*usrlay, GFP_KERNEL);
usrlay = kmalloc_obj(*usrlay);
if (!usrlay)
return -ENOMEM;

View File

@@ -416,7 +416,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
}
/* make a local copy of instr to avoid modifying the caller's struct */
erase = kmalloc_obj(struct erase_info, GFP_KERNEL);
erase = kmalloc_obj(struct erase_info);
if (!erase)
return -ENOMEM;

View File

@@ -53,7 +53,7 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent,
u64 tmp;
/* allocate the partition structure */
child = kzalloc_obj(*child, GFP_KERNEL);
child = kzalloc_obj(*child);
name = kstrdup(part->name, GFP_KERNEL);
if (!name || !child) {
printk(KERN_ERR"memory allocation error while creating partitions for \"%s\"\n",

View File

@@ -1413,11 +1413,11 @@ static void mtdswap_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
"%u spare, %u bad blocks\n",
MTDSWAP_PREFIX, part, swap_size / 1024, spare_cnt, bad_blocks);
d = kzalloc_obj(struct mtdswap_dev, GFP_KERNEL);
d = kzalloc_obj(struct mtdswap_dev);
if (!d)
return;
mbd_dev = kzalloc_obj(struct mtd_blktrans_dev, GFP_KERNEL);
mbd_dev = kzalloc_obj(struct mtd_blktrans_dev);
if (!mbd_dev) {
kfree(d);
return;

View File

@@ -227,7 +227,7 @@ int nand_ecc_sw_bch_init_ctx(struct nand_device *nand)
return -EINVAL;
}
engine_conf = kzalloc_obj(*engine_conf, GFP_KERNEL);
engine_conf = kzalloc_obj(*engine_conf);
if (!engine_conf)
return -ENOMEM;

View File

@@ -496,7 +496,7 @@ int nand_ecc_sw_hamming_init_ctx(struct nand_device *nand)
if (conf->step_size != 256 && conf->step_size != 512)
conf->step_size = 256;
engine_conf = kzalloc_obj(*engine_conf, GFP_KERNEL);
engine_conf = kzalloc_obj(*engine_conf);
if (!engine_conf)
return -ENOMEM;

View File

@@ -37,7 +37,7 @@ static int generic_onenand_probe(struct platform_device *pdev)
unsigned long size = resource_size(res);
int err;
info = kzalloc_obj(struct onenand_info, GFP_KERNEL);
info = kzalloc_obj(struct onenand_info);
if (!info)
return -ENOMEM;

View File

@@ -231,7 +231,7 @@ int onenand_default_bbt(struct mtd_info *mtd)
struct onenand_chip *this = mtd->priv;
struct bbm_info *bbm;
this->bbm = kzalloc_obj(struct bbm_info, GFP_KERNEL);
this->bbm = kzalloc_obj(struct bbm_info);
if (!this->bbm)
return -ENOMEM;

View File

@@ -156,7 +156,7 @@ int qcom_prepare_bam_async_desc(struct qcom_nand_controller *nandc,
enum dma_transfer_direction dir_eng;
struct dma_async_tx_descriptor *dma_desc;
desc = kzalloc_obj(*desc, GFP_KERNEL);
desc = kzalloc_obj(*desc);
if (!desc)
return -ENOMEM;
@@ -364,7 +364,7 @@ int qcom_prep_adm_dma_desc(struct qcom_nand_controller *nandc, bool read,
struct scatterlist *sgl;
int ret;
desc = kzalloc_obj(*desc, GFP_KERNEL);
desc = kzalloc_obj(*desc);
if (!desc)
return -ENOMEM;

View File

@@ -266,7 +266,7 @@ static int au1550nd_probe(struct platform_device *pdev)
return -ENODEV;
}
ctx = kzalloc_obj(*ctx, GFP_KERNEL);
ctx = kzalloc_obj(*ctx);
if (!ctx)
return -ENOMEM;

View File

@@ -678,7 +678,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
pci_set_master(pdev);
cafe = kzalloc_obj(*cafe, GFP_KERNEL);
cafe = kzalloc_obj(*cafe);
if (!cafe) {
err = -ENOMEM;
goto out_disable_device;

View File

@@ -273,7 +273,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
}
/* Allocate memory for MTD device structure and private data */
controller = kzalloc_obj(*controller, GFP_KERNEL);
controller = kzalloc_obj(*controller);
if (!controller) {
err = -ENOMEM;
goto out;

View File

@@ -895,13 +895,13 @@ static int fsl_elbc_nand_probe(struct platform_device *pdev)
return -ENODEV;
}
priv = kzalloc_obj(*priv, GFP_KERNEL);
priv = kzalloc_obj(*priv);
if (!priv)
return -ENOMEM;
mutex_lock(&fsl_elbc_nand_mutex);
if (!fsl_lbc_ctrl_dev->nand) {
elbc_fcm_ctrl = kzalloc_obj(*elbc_fcm_ctrl, GFP_KERNEL);
elbc_fcm_ctrl = kzalloc_obj(*elbc_fcm_ctrl);
if (!elbc_fcm_ctrl) {
mutex_unlock(&fsl_elbc_nand_mutex);
ret = -ENOMEM;

View File

@@ -1018,7 +1018,7 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
mutex_lock(&fsl_ifc_nand_mutex);
if (!fsl_ifc_ctrl_dev->nand) {
ifc_nand_ctrl = kzalloc_obj(*ifc_nand_ctrl, GFP_KERNEL);
ifc_nand_ctrl = kzalloc_obj(*ifc_nand_ctrl);
if (!ifc_nand_ctrl) {
mutex_unlock(&fsl_ifc_nand_mutex);
return -ENOMEM;

View File

@@ -1062,7 +1062,7 @@ static int nand_choose_interface_config(struct nand_chip *chip)
if (!nand_controller_can_setup_interface(chip))
return 0;
iface = kzalloc_obj(*iface, GFP_KERNEL);
iface = kzalloc_obj(*iface);
if (!iface)
return -ENOMEM;

View File

@@ -1375,7 +1375,7 @@ static int nand_create_badblock_pattern(struct nand_chip *this)
pr_warn("Bad block pattern already allocated; not replacing\n");
return -EINVAL;
}
bd = kzalloc_obj(*bd, GFP_KERNEL);
bd = kzalloc_obj(*bd);
if (!bd)
return -ENOMEM;
bd->options = this->bbt_options & BADBLOCK_SCAN_MASK;

View File

@@ -705,7 +705,7 @@ static int hynix_nand_init(struct nand_chip *chip)
else
chip->options |= NAND_BBM_FIRSTPAGE | NAND_BBM_SECONDPAGE;
hynix = kzalloc_obj(*hynix, GFP_KERNEL);
hynix = kzalloc_obj(*hynix);
if (!hynix)
return -ENOMEM;

View File

@@ -42,7 +42,7 @@ int nand_jedec_detect(struct nand_chip *chip)
return 0;
/* JEDEC chip: allocate a buffer to hold its parameter page */
p = kzalloc_obj(*p, GFP_KERNEL);
p = kzalloc_obj(*p);
if (!p)
return -ENOMEM;

View File

@@ -484,7 +484,7 @@ static int micron_nand_init(struct nand_chip *chip)
int ondie;
int ret;
micron = kzalloc_obj(*micron, GFP_KERNEL);
micron = kzalloc_obj(*micron);
if (!micron)
return -ENOMEM;

View File

@@ -306,7 +306,7 @@ int nand_onfi_detect(struct nand_chip *chip)
if (le16_to_cpu(p->opt_cmd) & ONFI_OPT_CMD_READ_CACHE)
chip->parameters.supports_read_cache = true;
onfi = kzalloc_obj(*onfi, GFP_KERNEL);
onfi = kzalloc_obj(*onfi);
if (!onfi) {
ret = -ENOMEM;
goto free_model;

View File

@@ -851,7 +851,7 @@ static int ns_parse_weakblocks(void)
}
if (*w == ',')
w += 1;
wb = kzalloc_obj(*wb, GFP_KERNEL);
wb = kzalloc_obj(*wb);
if (!wb) {
NS_ERR("unable to allocate memory.\n");
return -ENOMEM;
@@ -902,7 +902,7 @@ static int ns_parse_weakpages(void)
}
if (*w == ',')
w += 1;
wp = kzalloc_obj(*wp, GFP_KERNEL);
wp = kzalloc_obj(*wp);
if (!wp) {
NS_ERR("unable to allocate memory.\n");
return -ENOMEM;
@@ -953,7 +953,7 @@ static int ns_parse_gravepages(void)
}
if (*g == ',')
g += 1;
gp = kzalloc_obj(*gp, GFP_KERNEL);
gp = kzalloc_obj(*gp);
if (!gp) {
NS_ERR("unable to allocate memory.\n");
return -ENOMEM;
@@ -2268,7 +2268,7 @@ static int __init ns_init_module(void)
return -EINVAL;
}
ns = kzalloc_obj(struct nandsim, GFP_KERNEL);
ns = kzalloc_obj(struct nandsim);
if (!ns) {
NS_ERR("unable to allocate core structures.\n");
return -ENOMEM;

View File

@@ -113,7 +113,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
dev_dbg(dev, "pasemi_nand at %pR\n", &res);
/* Allocate memory for MTD device structure and private data */
ddata = kzalloc_obj(*ddata, GFP_KERNEL);
ddata = kzalloc_obj(*ddata);
if (!ddata) {
err = -ENOMEM;
goto out;

View File

@@ -867,7 +867,7 @@ static int r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
error = -ENOMEM;
/* init nand chip, but register it only on card insert */
chip = kzalloc_obj(struct nand_chip, GFP_KERNEL);
chip = kzalloc_obj(struct nand_chip);
if (!chip)
goto error4;
@@ -883,7 +883,7 @@ static int r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
chip->legacy.write_buf = r852_write_buf;
/* init our device structure */
dev = kzalloc_obj(struct r852_device, GFP_KERNEL);
dev = kzalloc_obj(struct r852_device);
if (!dev)
goto error5;

View File

@@ -132,7 +132,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
}
/* Allocate memory for MTD device structure and private data */
sharpsl = kzalloc_obj(struct sharpsl_nand, GFP_KERNEL);
sharpsl = kzalloc_obj(struct sharpsl_nand);
if (!sharpsl)
return -ENOMEM;

View File

@@ -319,7 +319,7 @@ static int txx9ndfmc_probe(struct platform_device *dev)
if (!(plat->ch_mask & (1 << i)))
continue;
txx9_priv = kzalloc_obj(struct txx9ndfmc_priv, GFP_KERNEL);
txx9_priv = kzalloc_obj(struct txx9ndfmc_priv);
if (!txx9_priv)
continue;
chip = &txx9_priv->chip;

View File

@@ -350,7 +350,7 @@ static int spinand_ondie_ecc_init_ctx(struct nand_device *nand)
nand->ecc.ctx.conf.step_size = nand->ecc.requirements.step_size;
nand->ecc.ctx.conf.strength = nand->ecc.requirements.strength;
engine_conf = kzalloc_obj(*engine_conf, GFP_KERNEL);
engine_conf = kzalloc_obj(*engine_conf);
if (!engine_conf)
return -ENOMEM;

View File

@@ -642,7 +642,7 @@ static int gd5fxgm9_spinand_init(struct spinand_device *spinand)
{
struct gigadevice_priv *priv;
priv = kzalloc_obj(*priv, GFP_KERNEL);
priv = kzalloc_obj(*priv);
if (!priv)
return -ENOMEM;

View File

@@ -499,7 +499,7 @@ static int macronix_spinand_init(struct spinand_device *spinand)
{
struct macronix_priv *priv;
priv = kzalloc_obj(*priv, GFP_KERNEL);
priv = kzalloc_obj(*priv);
if (!priv)
return -ENOMEM;

View File

@@ -45,7 +45,7 @@ static void nftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
pr_debug("NFTL: add_mtd for %s\n", mtd->name);
nftl = kzalloc_obj(struct NFTLrecord, GFP_KERNEL);
nftl = kzalloc_obj(struct NFTLrecord);
if (!nftl)
return;

View File

@@ -37,7 +37,7 @@ static int brcm_u_boot_parse(struct mtd_info *mtd,
int err;
int i = 0;
parts = kzalloc_objs(*parts, BRCM_U_BOOT_MAX_PARTS, GFP_KERNEL);
parts = kzalloc_objs(*parts, BRCM_U_BOOT_MAX_PARTS);
if (!parts)
return -ENOMEM;

View File

@@ -102,7 +102,7 @@ static int parse_fixed_partitions(struct mtd_info *master,
return 0;
}
parts = kzalloc_objs(*parts, nr_parts, GFP_KERNEL);
parts = kzalloc_objs(*parts, nr_parts);
if (!parts) {
if (dedicated)
of_node_put(ofpart_node);
@@ -249,7 +249,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
nr_parts = plen / sizeof(part[0]);
parts = kzalloc_objs(*parts, nr_parts, GFP_KERNEL);
parts = kzalloc_objs(*parts, nr_parts);
if (!parts)
return -ENOMEM;

View File

@@ -123,7 +123,7 @@ static int parse_qcomsmem_part(struct mtd_info *mtd,
numparts++;
}
parts = kzalloc_objs(*parts, numparts, GFP_KERNEL);
parts = kzalloc_objs(*parts, numparts);
if (!parts)
return -ENOMEM;

View File

@@ -203,7 +203,7 @@ nogood:
if (!redboot_checksum(&buf[i]))
break;
new_fl = kmalloc_obj(struct fis_list, GFP_KERNEL);
new_fl = kmalloc_obj(struct fis_list);
namelen += strlen(buf[i].name) + 1;
if (!new_fl) {
ret = -ENOMEM;

View File

@@ -80,7 +80,7 @@ static int scpart_scan_partmap(struct mtd_info *master, loff_t partmap_offs,
if (cnt > 0) {
int bytes = cnt * sizeof(*pdesc);
pdesc = kzalloc_objs(*pdesc, cnt, GFP_KERNEL);
pdesc = kzalloc_objs(*pdesc, cnt);
if (!pdesc) {
res = -ENOMEM;
goto free;

View File

@@ -82,7 +82,7 @@ static int mtd_parser_tplink_safeloader_parse(struct mtd_info *mtd,
int idx;
int err;
parts = kzalloc_objs(*parts, TPLINK_SAFELOADER_MAX_PARTS, GFP_KERNEL);
parts = kzalloc_objs(*parts, TPLINK_SAFELOADER_MAX_PARTS);
if (!parts) {
err = -ENOMEM;
goto err_out;

View File

@@ -270,7 +270,7 @@ static int erase_block(struct partition *part, int block)
struct erase_info *erase;
int rc;
erase = kmalloc_obj(struct erase_info, GFP_KERNEL);
erase = kmalloc_obj(struct erase_info);
if (!erase)
return -ENOMEM;
@@ -752,7 +752,7 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
mtd->size > UINT_MAX)
return;
part = kzalloc_obj(struct partition, GFP_KERNEL);
part = kzalloc_obj(struct partition);
if (!part)
return;

View File

@@ -64,7 +64,7 @@ static struct attribute_group *sm_create_sysfs_attributes(struct sm_ftl *ftl)
/* Initialize sysfs attributes */
vendor_attribute =
kzalloc_obj(struct sm_sysfs_attribute, GFP_KERNEL);
kzalloc_obj(struct sm_sysfs_attribute);
if (!vendor_attribute)
goto error2;
@@ -85,7 +85,7 @@ static struct attribute_group *sm_create_sysfs_attributes(struct sm_ftl *ftl)
attributes[0] = &vendor_attribute->dev_attr.attr;
/* Finally create the attribute group */
attr_group = kzalloc_obj(struct attribute_group, GFP_KERNEL);
attr_group = kzalloc_obj(struct attribute_group);
if (!attr_group)
goto error4;
attr_group->attrs = attributes;
@@ -1134,7 +1134,7 @@ static void sm_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
struct sm_ftl *ftl;
/* Allocate & initialize our private structure */
ftl = kzalloc_obj(struct sm_ftl, GFP_KERNEL);
ftl = kzalloc_obj(struct sm_ftl);
if (!ftl)
goto error1;
@@ -1156,7 +1156,7 @@ static void sm_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
goto error2;
/* Allocate zone array, it will be initialized on demand */
ftl->zones = kzalloc_objs(struct ftl_zone, ftl->zone_count, GFP_KERNEL);
ftl->zones = kzalloc_objs(struct ftl_zone, ftl->zone_count);
if (!ftl->zones)
goto error3;
@@ -1170,7 +1170,7 @@ static void sm_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
/* Allocate upper layer structure and initialize it */
trans = kzalloc_obj(struct mtd_blktrans_dev, GFP_KERNEL);
trans = kzalloc_obj(struct mtd_blktrans_dev);
if (!trans)
goto error5;

View File

@@ -1553,7 +1553,7 @@ spi_nor_init_erase_cmd(const struct spi_nor_erase_region *region,
{
struct spi_nor_erase_command *cmd;
cmd = kmalloc_obj(*cmd, GFP_KERNEL);
cmd = kmalloc_obj(*cmd);
if (!cmd)
return ERR_PTR(-ENOMEM);

View File

@@ -760,7 +760,7 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt,
u8 read_data_mask, map_id;
/* Use a kmalloc'ed bounce buffer to guarantee it is DMA-able. */
buf = kmalloc_obj(*buf, GFP_KERNEL);
buf = kmalloc_obj(*buf);
if (!buf)
return ERR_PTR(-ENOMEM);

View File

@@ -295,7 +295,7 @@ static void ssfdcr_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
if (cis_sector == -1)
return;
ssfdc = kzalloc_obj(*ssfdc, GFP_KERNEL);
ssfdc = kzalloc_obj(*ssfdc);
if (!ssfdc)
return;

View File

@@ -178,7 +178,7 @@ static int __init mtd_stresstest_init(void)
err = -ENOMEM;
readbuf = vmalloc(bufsize);
writebuf = vmalloc(bufsize);
offsets = kmalloc_objs(int, ebcnt, GFP_KERNEL);
offsets = kmalloc_objs(int, ebcnt);
if (!readbuf || !writebuf || !offsets)
goto out;
for (i = 0; i < ebcnt; i++)

View File

@@ -131,7 +131,7 @@ static struct ubi_ainf_volume *find_or_add_av(struct ubi_attach_info *ai,
return NULL;
/* The volume is absent - add it */
av = kzalloc_obj(*av, GFP_KERNEL);
av = kzalloc_obj(*av);
if (!av)
return ERR_PTR(-ENOMEM);
@@ -1451,7 +1451,7 @@ static struct ubi_attach_info *alloc_ai(const char *slab_name)
{
struct ubi_attach_info *ai;
ai = kzalloc_obj(struct ubi_attach_info, GFP_KERNEL);
ai = kzalloc_obj(struct ubi_attach_info);
if (!ai)
return ai;

View File

@@ -368,7 +368,7 @@ int ubiblock_create(struct ubi_volume_info *vi)
goto out_unlock;
}
dev = kzalloc_obj(struct ubiblock, GFP_KERNEL);
dev = kzalloc_obj(struct ubiblock);
if (!dev) {
ret = -ENOMEM;
goto out_unlock;

View File

@@ -930,7 +930,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
}
}
ubi = kzalloc_obj(struct ubi_device, GFP_KERNEL);
ubi = kzalloc_obj(struct ubi_device);
if (!ubi)
return -ENOMEM;

View File

@@ -727,7 +727,7 @@ static int rename_volumes(struct ubi_device *ubi,
int name_len = req->ents[i].name_len;
const char *name = req->ents[i].name;
re = kzalloc_obj(struct ubi_rename_entry, GFP_KERNEL);
re = kzalloc_obj(struct ubi_rename_entry);
if (!re) {
err = -ENOMEM;
goto out_free;
@@ -801,7 +801,7 @@ static int rename_volumes(struct ubi_device *ubi,
goto out_free;
}
re1 = kzalloc_obj(struct ubi_rename_entry, GFP_KERNEL);
re1 = kzalloc_obj(struct ubi_rename_entry);
if (!re1) {
err = -ENOMEM;
ubi_close_volume(desc);
@@ -1007,7 +1007,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
struct ubi_rnvol_req *req;
dbg_gen("re-name volumes");
req = kmalloc_obj(struct ubi_rnvol_req, GFP_KERNEL);
req = kmalloc_obj(struct ubi_rnvol_req);
if (!req) {
err = -ENOMEM;
break;

View File

@@ -124,11 +124,11 @@ struct ubi_eba_table *ubi_eba_create_table(struct ubi_volume *vol,
int err = -ENOMEM;
int i;
tbl = kzalloc_obj(*tbl, GFP_KERNEL);
tbl = kzalloc_obj(*tbl);
if (!tbl)
return ERR_PTR(-ENOMEM);
tbl->entries = kmalloc_objs(*tbl->entries, nentries, GFP_KERNEL);
tbl->entries = kmalloc_objs(*tbl->entries, nentries);
if (!tbl->entries)
goto err;
@@ -1535,11 +1535,11 @@ int self_check_eba(struct ubi_device *ubi, struct ubi_attach_info *ai_fastmap,
num_volumes = ubi->vtbl_slots + UBI_INT_VOL_COUNT;
scan_eba = kmalloc_objs(*scan_eba, num_volumes, GFP_KERNEL);
scan_eba = kmalloc_objs(*scan_eba, num_volumes);
if (!scan_eba)
return -ENOMEM;
fm_eba = kmalloc_objs(*fm_eba, num_volumes, GFP_KERNEL);
fm_eba = kmalloc_objs(*fm_eba, num_volumes);
if (!fm_eba) {
kfree(scan_eba);
return -ENOMEM;

View File

@@ -889,13 +889,13 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
down_write(&ubi->fm_protect);
memset(ubi->fm_buf, 0, ubi->fm_size);
fmsb = kmalloc_obj(*fmsb, GFP_KERNEL);
fmsb = kmalloc_obj(*fmsb);
if (!fmsb) {
ret = -ENOMEM;
goto out;
}
fm = kzalloc_obj(*fm, GFP_KERNEL);
fm = kzalloc_obj(*fm);
if (!fm) {
ret = -ENOMEM;
kfree(fmsb);

View File

@@ -281,7 +281,7 @@ static int gluebi_create(struct ubi_device_info *di,
struct gluebi_device *gluebi, *g;
struct mtd_info *mtd;
gluebi = kzalloc_obj(struct gluebi_device, GFP_KERNEL);
gluebi = kzalloc_obj(struct gluebi_device);
if (!gluebi)
return -ENOMEM;

View File

@@ -140,7 +140,7 @@ struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode)
goto out_put_ubi;
}
desc = kmalloc_obj(struct ubi_volume_desc, GFP_KERNEL);
desc = kmalloc_obj(struct ubi_volume_desc);
if (!desc) {
err = -ENOMEM;
goto out_put_ubi;

View File

@@ -75,7 +75,7 @@ static int ubi_nvmem_add(struct ubi_volume_info *vi)
WARN_ON_ONCE(vi->size <= 0))
return -EINVAL;
unv = kzalloc_obj(struct ubi_nvmem, GFP_KERNEL);
unv = kzalloc_obj(struct ubi_nvmem);
if (!unv)
return -ENOMEM;

View File

@@ -172,7 +172,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
if (ubi->ro_mode)
return -EROFS;
vol = kzalloc_obj(struct ubi_volume, GFP_KERNEL);
vol = kzalloc_obj(struct ubi_volume);
if (!vol)
return -ENOMEM;

View File

@@ -531,7 +531,7 @@ static int init_volumes(struct ubi_device *ubi,
if (be32_to_cpu(vtbl[i].reserved_pebs) == 0)
continue; /* Empty record */
vol = kzalloc_obj(struct ubi_volume, GFP_KERNEL);
vol = kzalloc_obj(struct ubi_volume);
if (!vol)
return -ENOMEM;
@@ -623,7 +623,7 @@ static int init_volumes(struct ubi_device *ubi,
}
/* And add the layout volume */
vol = kzalloc_obj(struct ubi_volume, GFP_KERNEL);
vol = kzalloc_obj(struct ubi_volume);
if (!vol)
return -ENOMEM;