From patchwork Tue Jul 14 01:48:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaehyun Lim X-Patchwork-Id: 6783271 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7A9B3C05AC for ; Tue, 14 Jul 2015 01:49:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7A332064B for ; Tue, 14 Jul 2015 01:49:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2E4F2063E for ; Tue, 14 Jul 2015 01:49:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753025AbbGNBtL (ORCPT ); Mon, 13 Jul 2015 21:49:11 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36018 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752219AbbGNBtJ (ORCPT ); Mon, 13 Jul 2015 21:49:09 -0400 Received: by pachj5 with SMTP id hj5so41334470pac.3 for ; Mon, 13 Jul 2015 18:49:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5v++/a59UY9FHq3+RyWd+f0ofJsryeK63nuXDdX1wrc=; b=XkVGo/SMMEBKU0ArRnGcIe6viijn7/UAyYbUL5P+VWhfnyls0MXYDT13z/SLM/kdoJ 4XejLH7vtC86U80rDbriqkt1GUPjc6HSDJrkpGdRbKQHNJbIMe2iv4esFrh0WI1E6oQr e3U7mba+EMeYexy/kaii0kyLK9GN1fb5KvqdKAXoS1CSZC7jhNjFEsckVw6QfuRQKpqs K1FQqfqNLg1hBRe/l6h6YlIpJdLNLNgcYdMlginNcJuT3LxCzsY7HZfvnAz/mIn+AbwJ uYeGTGQi+mIejxxSq3qUeADyJFnZp6bjxOtQGQwVq5yg00dQtJI1HHbVMPADK4nmwbuO GzGw== X-Received: by 10.66.149.229 with SMTP id ud5mr74770655pab.2.1436838549392; Mon, 13 Jul 2015 18:49:09 -0700 (PDT) Received: from localhost.localdomain ([218.233.16.2]) by smtp.gmail.com with ESMTPSA id he9sm19858713pbc.7.2015.07.13.18.49.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Jul 2015 18:49:08 -0700 (PDT) From: Chaehyun Lim To: gregkh@linuxfoundation.org Cc: johnny.kim@atmel.com, rachel.kim@atmel.com, dean.lee@atmel.com, chris.park@atmel.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, Chaehyun Lim Subject: [PATCH 2/2] staging: wilc1000: fix memory allocation error check Date: Tue, 14 Jul 2015 10:48:41 +0900 Message-Id: <1436838521-8200-2-git-send-email-chaehyun.lim@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436838521-8200-1-git-send-email-chaehyun.lim@gmail.com> References: <1436838521-8200-1-git-send-email-chaehyun.lim@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove WILC_ERRORREPORT macro. If memory allocation is failed, jump to a label to return this function with WILC_NO_MEM. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/host_interface.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index ca97b70..f6ba7d1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -7142,8 +7142,11 @@ s32 host_int_add_beacon(WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, /* Bug 4599 : if tail length = 0 skip allocating & copying */ if (u32TailLen > 0) { pstrSetBeaconParam->pu8Tail = (u8 *)WILC_MALLOC(u32TailLen); - if (pstrSetBeaconParam->pu8Tail == NULL) - WILC_ERRORREPORT(s32Error, WILC_NO_MEM); + if (pstrSetBeaconParam->pu8Tail == NULL) { + PRINT_ER("Failed to allocate memory\n"); + s32Error = WILC_NO_MEM; + goto _fail_; + } WILC_memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); } else { pstrSetBeaconParam->pu8Tail = NULL;