From patchwork Mon Nov 11 09:52:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 1192850 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="VxD0kAQq"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47BR495Kjmz9sPc for ; Mon, 11 Nov 2019 20:52:09 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 6160AC21C8B; Mon, 11 Nov 2019 09:52:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6DDBEC21C29; Mon, 11 Nov 2019 09:51:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D13ABC21C29; Mon, 11 Nov 2019 09:51:57 +0000 (UTC) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lists.denx.de (Postfix) with ESMTPS id 4108BC21BE5 for ; Mon, 11 Nov 2019 09:51:57 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xAB9ptSC067322; Mon, 11 Nov 2019 03:51:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1573465915; bh=ZaXo/xi2Scq4W+5afU7fBDTKTwdwCnb1pq4W6iNQSlo=; h=From:To:CC:Subject:Date; b=VxD0kAQqfIqnBnNExA2mGkqlJx/8o46W25M0haEnSo+Jmf42IGUXwFViZ5uWsvSGy Qmk1M1oBJ+gJJAAnMACn21vQ8UQ75U6xh5aHv4kYS7Xoqs7m5F16M4GvFD5aAdjEYE Qq1W7krx3vp5tbYyRrSL5hln2hjjqUDrf8VvW8wc= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xAB9pt6V063366 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 11 Nov 2019 03:51:55 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Mon, 11 Nov 2019 03:51:38 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Mon, 11 Nov 2019 03:51:38 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id xAB9prwp043110; Mon, 11 Nov 2019 03:51:53 -0600 From: Faiz Abbas To: Date: Mon, 11 Nov 2019 15:22:56 +0530 Message-ID: <20191111095256.3528-1-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: joe.hershberger@ni.com Subject: [U-Boot] [PATCH] net: cpsw: Add NULL pointer check X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add null pointer check to take care of out of memory errors. Signed-off-by: Faiz Abbas Reviewed-by: Grygorii Strashko --- drivers/net/ti/cpsw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c index 4a990be93e..b710ae4053 100644 --- a/drivers/net/ti/cpsw.c +++ b/drivers/net/ti/cpsw.c @@ -1223,6 +1223,9 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) int ret; data = calloc(1, sizeof(struct cpsw_platform_data)); + if (!data) + return -ENOMEM; + pdata->priv_pdata = data; pdata->iobase = dev_read_addr(dev); data->version = CPSW_CTRL_VERSION_2;