From patchwork Thu Jul 30 11:41:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaehyun Lim X-Patchwork-Id: 6902011 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 6584BC05AC for ; Thu, 30 Jul 2015 11:41:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8701520529 for ; Thu, 30 Jul 2015 11:41:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC2F920528 for ; Thu, 30 Jul 2015 11:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754567AbbG3Ll0 (ORCPT ); Thu, 30 Jul 2015 07:41:26 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:36486 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754557AbbG3LlZ (ORCPT ); Thu, 30 Jul 2015 07:41:25 -0400 Received: by pachj5 with SMTP id hj5so22354607pac.3 for ; Thu, 30 Jul 2015 04:41:25 -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=Bodfw9EYxVCxAptskDQ98zRG3/HCVWBcXuK7kkyBKqs=; b=nxlLHFAs3XcJVQg76sMqcfE1Lp66Mp8moo4zJrequWQauh3Fn+mFO18GlyJwp+bNLB XpI1xYeA/w88QGen7T/r7l2Mug9FhJrKw6tsViqX60ybsXLkqfDCvnS5WII1W1qFLG6+ M2DrLSE8BLkJy1RuI3owjSu7fpqxnQhZFXwdcXSk5qHVFsFlei17VS82UbCVSW16StdR XYZWC8vWM4zCzwyyGu+U2gvAS/cQLWa0F1chu1EzMcIoDHIS/nZ/cwMKPp6Y1MQkN8yR ljda5iX80kIOe8Qt0XvPgkZmsMWe18HdijACBHqIpqXzhKSXJO9qBe9sAo/WxTBxXTM0 BlXQ== X-Received: by 10.66.142.199 with SMTP id ry7mr80378964pab.14.1438256485072; Thu, 30 Jul 2015 04:41:25 -0700 (PDT) Received: from localhost.localdomain ([218.233.16.2]) by smtp.gmail.com with ESMTPSA id or7sm1834117pdb.9.2015.07.30.04.41.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Jul 2015 04:41:24 -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: [RESEND V2 3/3] staging: wilc1000: coreconfigurator.c: fix kmalloc error check Date: Thu, 30 Jul 2015 20:41:05 +0900 Message-Id: <1438256465-19540-4-git-send-email-chaehyun.lim@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438256465-19540-1-git-send-email-chaehyun.lim@gmail.com> References: <1438256465-19540-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 Return -ENOMEM if memory allocation is failed. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/coreconfigurator.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 67cec9d..258a0d2 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -675,11 +675,8 @@ s32 CoreConfiguratorInit(void) sema_init(&SemHandlePktResp, 0); gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_KERNEL); - if (gps8ConfigPacket == NULL) { - PRINT_ER("failed in gps8ConfigPacket allocation\n"); - s32Error = WILC_NO_MEM; - goto _fail_; - } + if (!gps8ConfigPacket) + return -ENOMEM; WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE); @@ -1031,10 +1028,8 @@ s32 ParseSurveyResults(u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ pstrSurveyResults = kmalloc_array(u32SurveyResultsCount, sizeof(wid_site_survey_reslts_s), GFP_KERNEL); - if (pstrSurveyResults == NULL) { - u32SurveyResultsCount = 0; - WILC_ERRORREPORT(s32Error, WILC_NO_MEM); - } + if (!pstrSurveyResults) + return -ENOMEM; WILC_memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s));