Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261457AbVCFSVs (ORCPT ); Sun, 6 Mar 2005 13:21:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261460AbVCFSVs (ORCPT ); Sun, 6 Mar 2005 13:21:48 -0500 Received: from rusty.kulnet.kuleuven.ac.be ([134.58.240.42]:42467 "EHLO rusty.kulnet.kuleuven.ac.be") by vger.kernel.org with ESMTP id S261457AbVCFSVq (ORCPT ); Sun, 6 Mar 2005 13:21:46 -0500 From: "Panagiotis Issaris" Date: Sun, 6 Mar 2005 19:21:45 +0100 To: benh@kernel.crashing.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2.6.11-mm1] ibm_emac_core: add memory allocation failure handling Message-ID: <20050306182144.GA6428@mech.kuleuven.ac.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6+20040907i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1146 Lines: 27 Hi, This patch adds failure handling for a kmalloc() in the driver for the IBM 4xx PowerPC builtin ethernet. Signed-off-by: diff -pruN linux-2.6.11-orig/drivers/net/ibm_emac/ibm_emac_core.c linux-2.6.11-pi/drivers/net/ibm_emac/ibm_emac_core.c --- linux-2.6.11-orig/drivers/net/ibm_emac/ibm_emac_core.c 2005-03-05 03:30:09.000000000 +0100 +++ linux-2.6.11-pi/drivers/net/ibm_emac/ibm_emac_core.c 2005-03-06 19:00:10.000000000 +0100 @@ -1957,6 +1957,11 @@ static int emac_probe(struct ocp_device struct 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); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/