From patchwork Fri Jan 1 20:30:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7939981 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7B2879F350 for ; Fri, 1 Jan 2016 20:30:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A75FA204FF for ; Fri, 1 Jan 2016 20:30:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC0802011D for ; Fri, 1 Jan 2016 20:30:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752413AbcAAUaZ (ORCPT ); Fri, 1 Jan 2016 15:30:25 -0500 Received: from mout.web.de ([212.227.17.11]:64129 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752263AbcAAUaY (ORCPT ); Fri, 1 Jan 2016 15:30:24 -0500 Received: from [192.168.1.2] ([77.182.63.9]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MHp8z-1aGUJf27CP-003cHW; Fri, 01 Jan 2016 21:30:14 +0100 Subject: [PATCH 1/3] net-iwlegacy: Refactoring for il_eeprom_init() To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Kalle Valo , Stanislaw Gruszka References: <566ABCD9.1060404@users.sourceforge.net> <5686E13F.2010309@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <5686E1D2.60107@users.sourceforge.net> Date: Fri, 1 Jan 2016 21:30:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5686E13F.2010309@users.sourceforge.net> X-Provags-ID: V03:K0:5jETzftjRIn3JI87XtOVZvpcVu0xuo9jUIeeUYeBtGI1H86j9/A mo9UPotzHyf+sFsRHZuqhFRLscEzIBXhBSAagXqVX+0/96sNWypucY+i8qeeXcKBFkPSx2q h13bg5B6ug7GlIpmL6U9r/3kZqOHeZ9v6WSrnE/yrYpQbHEJjIzS4RgJnXS4ehOlGR8BtTE RtKQxQPlF7IbFcxbtiOTg== X-UI-Out-Filterresults: notjunk:1; V01:K0:dUmQOzi4+yY=:6uIvgi6I6WgxguSAYrcccp MVxlqrVEHzZSTXwhn8OuHAe7tvK4wdVdCm2v3M6D0/UmpS9HzcK7cz3Hh2MiLfVbiAdMnHL21 Ixm6oMGhQbJBpEJ8AucHdkKjVmU0eS51wZRMyLZmd2PrgoazgznBBhm/pKEbrzte+AxB9D121 /aGgx2+TNkRDvuSQv9yJyNfLRgji3kJHz3cYYg+V9HJY1wPxVSqre7LtFMMJyPbZlTBifh2MW mhB8icV3CMBPBcsqp16NulYGQTeey2F6OuGc+4UCxIS4Hizn0CFMX23MhIdkvzetm+Yq7Sb4A oj7RfjQqCnr5HO0trsu38U4LQeIBRiiJyfWS8phPtB/BBSPffVqVArwHGagnfNg2DvneEPTmI EYfsqmHbG2LypAh02ByPPE01teILhiUzHmoW9TVYwWCVbO8REvhG1L8fp4sv+WJqcjR+bCWBY 7izvz0HWsi1VmL6WUu1vGAlS6SKwpOj1ot+8LvTKddKL81ayKw08MjwE+2uD5FJQ6X2HAvozI tLt3IDdReh5E9XkPpsSmrxV9CC5m1paS3mSQeJZeLg6s49UA16PCiSaH4klq5BC6msaDA9VeN 5rIJ+PcRsHfIJeFtgFt5EWeBstP76VdXkLUWqgxVWMjAxt7AzAcce9d9+MFFW0caiNXswGbFP PyKo1cezISOEciKugKhv3Ta9evOLmOwyMdBStjVahoJrySQXdUJ7IxzWeY11zc94RR2fazAuJ R4BpN8fk2SUQjlkuilyqPc14bD+ZRkcarOFosCPUT1WXeRIbiBipVzv/dda8O+Q1ANO2kmbbD S17LE84 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 From: Markus Elfring Date: Fri, 1 Jan 2016 20:54:25 +0100 Return directly if a memory allocation failed at the beginning. Signed-off-by: Markus Elfring Acked-by: Stanislaw Gruszka --- drivers/net/wireless/intel/iwlegacy/common.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c index eb5cb60..c3afaf7 100644 --- a/drivers/net/wireless/intel/iwlegacy/common.c +++ b/drivers/net/wireless/intel/iwlegacy/common.c @@ -723,10 +723,9 @@ il_eeprom_init(struct il_priv *il) sz = il->cfg->eeprom_size; D_EEPROM("NVM size = %d\n", sz); il->eeprom = kzalloc(sz, GFP_KERNEL); - if (!il->eeprom) { - ret = -ENOMEM; - goto alloc_err; - } + if (!il->eeprom) + return -ENOMEM; + e = (__le16 *) il->eeprom; il->ops->apm_init(il); @@ -778,7 +777,6 @@ err: il_eeprom_free(il); /* Reset chip to save power until we load uCode during "up". */ il_apm_stop(il); -alloc_err: return ret; } EXPORT_SYMBOL(il_eeprom_init);