ibm_emac_core: add memory allocation failure handling
PATCH 1/1 ibm_emac_core: add memory allocation failure handling
Hi,
This patch adds failure handling for a kmalloc() in the driver for the IBM 4xx PowerPC builtin ethernet.
Signed-off-by <[email protected]>
drivers/net/ibm_emac/ibm_emac_core.c +5 -0
@@ -1957,6 +1957,11 @@ static int emac_probe(struct ocp_devicestruct emac_def_dev *ddev;/* Add this index to the deferred init table */ ddev =kmalloc (sizeof (struct emac_def_dev ),GFP_KERNEL ); +if (!ddev) { +printk (KERN_ERR "emac%d: Memory allocation failed.\n" , + ocpdev->def->index); +return -ENOMEM ; + } ddev->ocpdev = ocpdev; ddev->mal = mal;list_add_tail (&ddev->link, &emac_init_list);