Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1371032iol; Sun, 12 Jun 2022 14:18:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaBuX0iHTx8MdeRL/wd5EMNeu30936Mq6ko3VB1zJAJAYuVct0PcwznLN13jHHswVRoT0n X-Received: by 2002:a17:902:8d98:b0:168:a310:3ea6 with SMTP id v24-20020a1709028d9800b00168a3103ea6mr20778003plo.9.1655068732834; Sun, 12 Jun 2022 14:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655068732; cv=none; d=google.com; s=arc-20160816; b=PP70GfJDWE0EKANulcURv9AadQvsdG8rloo3soY6/8vuYwK8tYr7YsXnsmCUTKcgPc E+P1r+9QOf/3R34fop3F1Z7KOwEOzG/di1SI1RsAHQbQ6DinmbhW6ywysfYw1hf5s85Y tpBtP+KWxtXhkB0QvBgJxOWwJdGffU8mExWXb9/It7qNLOl6VY9BSQ7NZMqhuJezzJsz 1w55RiivrEk/acaEsFNwi1S8+1rfXeqvicUOGPW4SXp64Dwfg/IvPiv4HkqrFiD8Untc QeRMKOT/HUL6vgtAZU5WKY0c2BQc7EqPUQrcv85VPJNhl8Rmsc8hIf0+lDp8kUyUVjYo Au5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=aVqErYY3qKmv65qI19517KPl5efCVa17//4N4mf4v2E=; b=uqwfad4iYEwuFM3NYSTtVcZnrt4/04bXitLcrjvnjV8/xj0zWb5e0pnu9wE4XiI8Nz FiG102pvE3nL7riCDUoioX/7nd5S+AdKBcdsPFF2a12ACMDAlgyjnxX81Sf3ExqMsRHZ t2I4mW7Yc+jnfeF3NFHQVSBvl3AggvtNOPi4Yt5QI9QnnHdsTerWeNl5fYYDzFHUwua0 jJJ2NrzAHAEIfNeXYSdf0Sx8RsVQuIpzLs6xNnXaZ+VX+qscIAKTVnh1/enAtp0uSiKi nlySsnVlauhnjDPikPTt5ZkiHAOD9/n4+ug7CJzXO6IuMKo9WJvbRsb9WlKyfL0SzAup OZOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v202-20020a6361d3000000b003fbc1919bb8si6818005pgb.539.2022.06.12.14.18.45; Sun, 12 Jun 2022 14:18:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235481AbiFLVMb (ORCPT + 65 others); Sun, 12 Jun 2022 17:12:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234678AbiFLVM3 (ORCPT ); Sun, 12 Jun 2022 17:12:29 -0400 Received: from smtp.smtpout.orange.fr (smtp06.smtpout.orange.fr [80.12.242.128]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78148C6F for ; Sun, 12 Jun 2022 14:12:25 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id 0UsfoNjEHm7vs0UsfoeDyX; Sun, 12 Jun 2022 23:12:23 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 12 Jun 2022 23:12:23 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Christian Lamparter , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "John W. Linville" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Christian Lamparter , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2] p54: Fix an error handling path in p54spi_probe() Date: Sun, 12 Jun 2022 23:12:20 +0200 Message-Id: <297d2547ff2ee627731662abceeab9dbdaf23231.1655068321.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If an error occurs after a successful call to p54spi_request_firmware(), it must be undone by a corresponding release_firmware() as already done in the error handling path of p54spi_request_firmware() and in the .remove() function. Add the missing call in the error handling path and remove it from p54spi_request_firmware() now that it is the responsibility of the caller to release the firmawre Fixes: cd8d3d321285 ("p54spi: p54spi driver") Signed-off-by: Christophe JAILLET --- v2: reduce diffstat and take advantage on the fact that release_firmware() checks for NULL --- drivers/net/wireless/intersil/p54/p54spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/p54/p54spi.c b/drivers/net/wireless/intersil/p54/p54spi.c index f99b7ba69fc3..19152fd449ba 100644 --- a/drivers/net/wireless/intersil/p54/p54spi.c +++ b/drivers/net/wireless/intersil/p54/p54spi.c @@ -164,7 +164,7 @@ static int p54spi_request_firmware(struct ieee80211_hw *dev) ret = p54_parse_firmware(dev, priv->firmware); if (ret) { - release_firmware(priv->firmware); + /* the firmware is released by the caller */ return ret; } @@ -659,6 +659,7 @@ static int p54spi_probe(struct spi_device *spi) return 0; err_free_common: + release_firmware(priv->firmware); free_irq(gpio_to_irq(p54spi_gpio_irq), spi); err_free_gpio_irq: gpio_free(p54spi_gpio_irq); -- 2.34.1