mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 14:10:43 +00:00
nand: vybrid: Use calloc() instead of malloc() to allocate struct nfc
Without this change it is possible that Vybrid's NFC driver malloc() call will obtain some memory used (and correctly free'd) by some previous driver (in this case pinctrl for Vybrid). As a result some fields of struct nfc - in out case mtd->_get_device - are "pre initialized" with some random values. On the latter stage of booting, when e.g. somebody calls 'mtdparts default' the "data abort" is observed when __get_mtd_device() function is called. The mtd->_get_device pointer is not NULL and wrong value is referenced. Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
This commit is contained in:
parent
f026c1d9ef
commit
254409dbe8
1 changed files with 1 additions and 1 deletions
|
@ -641,7 +641,7 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr)
|
|||
.flash_bbt = 1,
|
||||
};
|
||||
|
||||
nfc = malloc(sizeof(*nfc));
|
||||
nfc = calloc(1, sizeof(*nfc));
|
||||
if (!nfc) {
|
||||
printf(KERN_ERR "%s: Memory exhausted!\n", __func__);
|
||||
return -ENOMEM;
|
||||
|
|
Loading…
Reference in a new issue