From patchwork Mon Oct 30 07:20:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 159531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2033243vqb; Mon, 30 Oct 2023 00:21:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHZnSFqLHLwE0pRdKOCiUbQM5dmjF0v5M2QK6kKR//q8bmCkdLABSXx4LJD63xNVqOi470 X-Received: by 2002:a17:902:cec2:b0:1cc:d00:4082 with SMTP id d2-20020a170902cec200b001cc0d004082mr7888932plg.39.1698650507757; Mon, 30 Oct 2023 00:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698650507; cv=none; d=google.com; s=arc-20160816; b=Trh91q7yhur1awkMURMgiJHl2dw7oqA7X+ceAnVB0BdNfPQq1+R/uYrQhZ9tey20ol lB1D3OJtfwGeSSvjyCx/mdCzTRJmzFqqZywtDJpAIEgWB9kgxixd4CF585azWtprExxY bIoG01mPc0ngaZERN4fxcRbgyeFFtJeiSkO/MMi6rwoseEx7p1AGjHyFQFNNgDlbWw2e cUXL7jhV5VY+/mVANE5E2tSlCjmswSayXns5qQkXmiDadxr11KhrUwzgvpwKhHPHHpc8 p735B3iEdknaUtagnsOsZW/JGRnYgXQecPPDASelK9rKo4pYqL5t1+T4ALVjL/FFgbqq EZsA== 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:dkim-signature; bh=7XgPRehCSAWCRbDjmZl/84CZ6/WWxMs6uaboa+ApIJw=; fh=Bo9rzUMEbbsrr+A0uUeo9kyebP2VqMZj019klnr0tQo=; b=0Avkjzo45chGITTO/H9bG4kg7bXB+Z7E/vsBsRO909/4wsxB9A0/hCobTUEAxYtxl0 79Myp8f6JUZJVgQG4Snl/xn11UsjQjzjbF6caFvf7FWyi+NfR/fanrrRtA6Fg3IW8vR3 yLxiCzKDFCZ2hpuFT4KXsQPaT5SftHLT7U00RwNFcU4rgc39+Ui+cHy+dcOb9X6pmdmc QNGalAyuHDCWzVE8a167O6cw7Nnd1kpERe9J4aKzOfGPyFCFCcVSGDQRpLiz8O9uMVKj oJSNa3CP/L7Tn8WteLZFHbw2y0nUJ6VJTDR24AFLA/rbtX2cjq8m8UjcbZv3g0i1nw0/ afIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=BpQwBHoE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id ky16-20020a170902f99000b001c9ce2b6b97si4697843plb.198.2023.10.30.00.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 00:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=BpQwBHoE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id ABBE680ABB2A; Mon, 30 Oct 2023 00:21:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232014AbjJ3HVN (ORCPT + 32 others); Mon, 30 Oct 2023 03:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232057AbjJ3HUk (ORCPT ); Mon, 30 Oct 2023 03:20:40 -0400 Received: from smtp.smtpout.orange.fr (smtp-28.smtpout.orange.fr [80.12.242.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E07DD7B for ; Mon, 30 Oct 2023 00:20:31 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id xMZXqGw8VIsudxMZXqcmOd; Mon, 30 Oct 2023 08:20:28 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1698650428; bh=7XgPRehCSAWCRbDjmZl/84CZ6/WWxMs6uaboa+ApIJw=; h=From:To:Cc:Subject:Date; b=BpQwBHoE2T3irox9hMtwFlrsmiWk6BjqE45Zz12TX3diF9APEZ5rKQFCektaKsfTi +gOggw3fke5Z48pTjDYUQeQyHSyBCXu4+Euh4p3ujAjSAylJpOVYnWTLYUKWl6RrJU kZx0ek7fJ5nwV/Omem0GvSH6x1pj01Plg6ypzoxmUfeaMOdulGs8O9USdP5MZd4MBt +l1QsIBE5Mzx0hkIh0MYSE5xmRbcjzhOzgCr7QtJwLm8zH+W7SoYMAlRe1ryjL8TlW 8GyU6IXR82HxyP2n8iIJiSErPFEgPUreA3NujAEXJcftwe1yrWQnDuhj3Tn6epi2Uj LM5DMbYOkBfZA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 30 Oct 2023 08:20:28 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Antti Palosaari , Mauro Carvalho Chehab , Brad Love , Sean Young Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Mauro Carvalho Chehab , linux-media@vger.kernel.org Subject: [PATCH] media: dvb-frontends: m88ds3103: Fix a memory leak in an error handling path of m88ds3103_probe() Date: Mon, 30 Oct 2023 08:20:26 +0100 Message-Id: <1b254cae201809f85e9884ed33ae72ff6338017d.1698650397.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 00:21:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781164154330942618 X-GMAIL-MSGID: 1781164154330942618 If an error occurs after a successful i2c_mux_add_adapter(), then i2c_mux_del_adapters() should be called to free some resources, as already done in the remove function. Fixes: e6089feca460 ("media: m88ds3103: Add support for ds3103b demod") Signed-off-by: Christophe JAILLET --- drivers/media/dvb-frontends/m88ds3103.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index 26c67ef05d13..e0272054fca5 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -1894,7 +1894,7 @@ static int m88ds3103_probe(struct i2c_client *client) /* get frontend address */ ret = regmap_read(dev->regmap, 0x29, &utmp); if (ret) - goto err_kfree; + goto err_del_adapters; dev->dt_addr = ((utmp & 0x80) == 0) ? 0x42 >> 1 : 0x40 >> 1; dev_dbg(&client->dev, "dt addr is 0x%02x\n", dev->dt_addr); @@ -1902,11 +1902,14 @@ static int m88ds3103_probe(struct i2c_client *client) dev->dt_addr); if (IS_ERR(dev->dt_client)) { ret = PTR_ERR(dev->dt_client); - goto err_kfree; + goto err_del_adapters; } } return 0; + +err_del_adapters: + i2c_mux_del_adapters(dev->muxc); err_kfree: kfree(dev); err: