From patchwork Sat May 20 07:38:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 684451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5E52C77B7D for ; Sat, 20 May 2023 07:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbjETHib (ORCPT ); Sat, 20 May 2023 03:38:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjETHi2 (ORCPT ); Sat, 20 May 2023 03:38:28 -0400 Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2AEC1A8 for ; Sat, 20 May 2023 00:38:26 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 0HAVqW6X7JVCN0HAVqfvyc; Sat, 20 May 2023 09:38:25 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1684568305; bh=NMjTFjxZxa7W+uVqFF89Z29R05LLDCicjWL4MP87TLA=; h=From:To:Cc:Subject:Date; b=rjfSfBGl4jypnBJRKK4oqNz4knkIQvQt35+3zw44PGHb8ZXZAdN6zVsLZP690+JIr /ZR2d8XIqBwP1JuiHyaRMKIGdurVz4gklakLC+Y8qHtfu3BibGOACEVxhewlRNGSdi HsH3opyCszrZ0qEyI+CFyW8MT0aZXr+QX6dqzpsEKuKnMtzFMFGUL0vWzY4dg4uSd9 mim6BrdJVCZETBuzOaWLXt+TnsHPzzK5Vuy2r3KDwmDLYaC0LIZaHoYFkBwIIlYcfl ohxbqvZiRFyzMswmwBir5Zrpq0r2EaAcyqbQZvxNivgc83CgAfJuCky1YU92P6KKl5 4SRn2Bi2Y97QQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 20 May 2023 09:38:25 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Kalle Valo , Dominik Brodowski Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-wireless@vger.kernel.org Subject: [PATCH] orinoco: Fix an error handling path in orinoco_cs_probe() Date: Sat, 20 May 2023 09:38:22 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Should orinoco_cs_config() fail, some resources need to be released as already done in the remove function. While at it, remove a useless and erroneous comment. The probe is orinoco_cs_probe(), not orinoco_cs_attach(). Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions") Signed-off-by: Christophe JAILLET --- drivers/net/wireless/intersil/orinoco/orinoco_cs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_cs.c b/drivers/net/wireless/intersil/orinoco/orinoco_cs.c index a956f965a1e5..03bfd2482656 100644 --- a/drivers/net/wireless/intersil/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/intersil/orinoco/orinoco_cs.c @@ -96,6 +96,7 @@ orinoco_cs_probe(struct pcmcia_device *link) { struct orinoco_private *priv; struct orinoco_pccard *card; + int ret; priv = alloc_orinocodev(sizeof(*card), &link->dev, orinoco_cs_hard_reset, NULL); @@ -107,8 +108,16 @@ orinoco_cs_probe(struct pcmcia_device *link) card->p_dev = link; link->priv = priv; - return orinoco_cs_config(link); -} /* orinoco_cs_attach */ + ret = orinoco_cs_config(link); + if (ret) + goto err_free_orinocodev; + + return 0; + +err_free_orinocodev: + free_orinocodev(priv); + return ret; +} static void orinoco_cs_detach(struct pcmcia_device *link) {