From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752563AbdKXHjG (ORCPT ); Fri, 24 Nov 2017 02:39:06 -0500 Received: from mout.web.de ([212.227.15.14]:60276 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751577AbdKXHjE (ORCPT ); Fri, 24 Nov 2017 02:39:04 -0500 Subject: [PATCH 2/4] ASoC: wm2000: One function call less in wm2000_i2c_probe() after error detection From: SF Markus Elfring To: alsa-devel@alsa-project.org, patches@opensource.cirrus.com, Jaroslav Kysela , Liam Girdwood , Mark Brown , Takashi Iwai Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Fri, 24 Nov 2017 08:37:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:3zyP+EfuX7x/c4BLSB2MbW/d2+dxv9c50XI53RMvVmG08qhwMn2 Kgo76QkPIByoR5L/Tv88c+clBNw95BROA4b7Lla/g2yhAyEOHqm4Y+5Mdn1i8AMYf7+TNrq v0+uFIyMd6nlgByNkMt2pRrWHWRKFlCo9/jRzOX2SDPOL8oz7d7Qhe7oSiZVSP6Wy72aGWa /pVtX4tSt2OVffS8H3kmg== X-UI-Out-Filterresults: notjunk:1;V01:K0:If7/m1txRzo=:CXQEdT4bk+i68sF5ru59Vm le1ivA2GWzN66yFA52eIEl681JuJ7LImPVGqTECajD+w6lkTZZDerbvBo5haYndKi0QAn6HSa 2bMYoI5cLOiSSeaEUu/XrQOQxad5BYJIJ5PKTupj7qUZ17V9VAK8aIG59JFekwl+Kxx4V9Sib VSFF0pTQ2GlCGlweeVXJIiQRsIRQJ8mZkgNsYlR8MpTmxGmTDNqibxCJQI6etyGoXpj17X0p8 bkji2bdNOQIBegVKcQXXYkGJtN/1TjUIEdc4O1r+tpa8FwRaV3HMwYHH58OMWEjTq8COlss9t 2FEUDgR+ldpttFknMkeHfuZCvbzjCB4RT+IdTSrd1kSJ35tNdYrEa7MAmoOZeUCciHJaF+Fkt 6FI1AuFwU61eLjAdPcjlnIIOOruCj1JpiK5/2YVCnTNpEROeyNyV3fAJ5B0F18kgR67zKVxRR 8QuOA8EGuTcWCWAv7CbcyZtl87E/G3SCMuYgDRJPuRJoD8q6YrZAZC3+ZJ/fKgMiEoypTlCj9 mTjIGKITpJTciw3LWkL4I/7a8D18zyWszzkvvt7t6P8bjkp2V2e3Nxeib7i7DOpNIV9ijPsn6 2O1kWoK1ELpXtdWHtDIlhwnwcauqSLHSDO5b7ggLXXoBAHzWrvDJFGhlKh+0zSbwXQTq8folo TeZ9RpVMcVy9ib/ZOYww7m2pjKR5fOqT8k102cxpHouSdDmvqZQPgUdjZFlCMxFfO/8xDCCW4 8ri24YQGZcspt7orvnh2W3AVlEcy/9BR0MKOH85XzfzFDmJctBNcZyXVgAEKmXLnHD5CIkWBn n6sIQI+keWOwVlIiCZAmvTtAo1AS6aM2OT9hpu1KXR2lehrlh4= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Fri, 24 Nov 2017 07:45:59 +0100 The release_firmware() function was called in a few cases by the wm2000_i2c_probe() function during error handling even if the passed variable contained a null pointer. * Adjust jump targets according to the Linux coding style convention. * Delete the label "out" and an initialisation for the variable "fw" at the beginning which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- sound/soc/codecs/wm2000.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index ce936deed7e3..0ed2a8992df4 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c @@ -821,7 +821,7 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, struct wm2000_priv *wm2000; struct wm2000_platform_data *pdata; const char *filename; - const struct firmware *fw = NULL; + const struct firmware *fw; int ret, i; int reg; u16 id; @@ -840,7 +840,7 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, ret = PTR_ERR(wm2000->regmap); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", ret); - goto out; + return ret; } for (i = 0; i < WM2000_NUM_SUPPLIES; i++) @@ -868,7 +868,7 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, if (id != 0x2000) { dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id); ret = -ENODEV; - goto err_supplies; + goto disable_regulator; } reg = wm2000_read(i2c, WM2000_REG_REVISON); @@ -878,7 +878,7 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, if (IS_ERR(wm2000->mclk)) { ret = PTR_ERR(wm2000->mclk); dev_err(&i2c->dev, "Failed to get MCLK: %d\n", ret); - goto err_supplies; + goto disable_regulator; } filename = "wm2000_anc.bin"; @@ -893,7 +893,7 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, ret = request_firmware(&fw, filename, &i2c->dev); if (ret != 0) { dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret); - goto err_supplies; + goto disable_regulator; } /* Pre-cook the concatenation of the register address onto the image */ @@ -901,9 +901,9 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, wm2000->anc_download = devm_kzalloc(&i2c->dev, wm2000->anc_download_size, GFP_KERNEL); - if (wm2000->anc_download == NULL) { + if (!wm2000->anc_download) { ret = -ENOMEM; - goto err_supplies; + goto release_firmware; } wm2000->anc_download[0] = 0x80; @@ -918,12 +918,10 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, wm2000_reset(wm2000); ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0); - -err_supplies: - regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies); - -out: +release_firmware: release_firmware(fw); +disable_regulator: + regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies); return ret; } -- 2.15.0