From patchwork Sun Jun 4 15:42:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 103033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2204856vqr; Sun, 4 Jun 2023 08:54:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5iP3mslk2VN7HRCeO9prUkKhw3jKgxdLxRNWnwMWjP0Pf7FGI0Fpr9ZNaBvv2wd+kWBZSo X-Received: by 2002:a54:4691:0:b0:398:3152:fee1 with SMTP id k17-20020a544691000000b003983152fee1mr5172467oic.20.1685894092162; Sun, 04 Jun 2023 08:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685894092; cv=none; d=google.com; s=arc-20160816; b=Zvyo6sEPpYGiwAfwxFxUwFpIFTUpcV1g6DnlhYgr1JUhFQjY27rNiWCLo7h4Sun1Bv bggeEYdmbRDpquDaaU1DfEhSMKinP7J0kfVX6EJA4dgAb6JIMaXptrFIPgb0reLqkumD +9CbeR2NF4l5aUe6BjL7dP4OhUMuS1uveimLbpuniOXsSljzF8VVRlFAPA5y3jFactea aHKBfDWhj2NtzbFsXYoBojLlMz95/P+attSLw/0KLxb1VmaXRlT233D7fipoGRFoE5F3 t7+ZO+xlkiSiSVsCh2+zPzO30+XnLT2SHVAjZK6Mk6nyolOsnQ0OAB6uHXJ/v1wzj05/ OdwA== 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=KSBCYH83xSlnxT9AqAr79v1PKm1DqpwXR0ggzhv2kFU=; b=MjElTAvHw5uDWFejt8QizbVD/WjRltrzGt9tmfGljZLYGtvIh5AkpQ8+/4ryZ7SCHw 9KBMKJahtG1YsvKXoP38I7PDmXXCSvxNRQn30/ozHmFVGUo0FboVXrMeLoD4jEtIzYO9 ryg9mHeqIa2NpghQgZqNddeigjiZ2jH1xFnSESpPT+MqdwZ+VZN/0fnPcX906mT0QnRA sMosc1hKOhemFgtHkxV2aM/n9oe2qd6DDwYN0FWS1K5dEvdVE8mvzcIeKfrlCy6AxS9t YgViMne479RxAkXmQyBtM3m54Lg6wHXZVPtsxGz3Gh/0rhnZOJ2+bvNaoMWMg59iPQRU CctQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ZnL1ytK8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a63eb45000000b005289dd0ef00si2435562pgk.568.2023.06.04.08.54.38; Sun, 04 Jun 2023 08:54:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=ZnL1ytK8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbjFDPmj (ORCPT + 99 others); Sun, 4 Jun 2023 11:42:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjFDPmh (ORCPT ); Sun, 4 Jun 2023 11:42:37 -0400 Received: from smtp.smtpout.orange.fr (smtp-30.smtpout.orange.fr [80.12.242.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A24D5D3 for ; Sun, 4 Jun 2023 08:42:36 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 5psGqNLaQt9zc5psGqXS2j; Sun, 04 Jun 2023 17:42:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1685893355; bh=KSBCYH83xSlnxT9AqAr79v1PKm1DqpwXR0ggzhv2kFU=; h=From:To:Cc:Subject:Date; b=ZnL1ytK8458koQso49BCpWyOcEi755OnD8/aYZ70UWHbQUaXQ+XkwqFZLGG5+hG3Z yaXTsYtK78QlhCXUpeznPk5AA2jU+eMpncJPkdKMUeAq8OcE53BPbyQ+T7f6CiQ7YP zaQ6Wn66OPz1XYNoYQZH1LfM5PZRmm/Xg+BUaWjIxN9fHA97i0qZD7zpcpg7E+8+LX UULF2+Wtpp9xj9ZFJyAa0pMqitEleMxEPKAUnIVNlsEpfr3PmbaXLiDiLnHrLjkNkk Z6TIBh6/JrK674jq06KhMIcKUqxWNsn5aFWtT93SOOx+NN4lk8Ao7QlFbeKf9msp5Y m4SnGCinLe35A== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 04 Jun 2023 17:42:35 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Helge Deller , Imre Deak , Andrew Morton , Krzysztof Helt , Juha Yrjola Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH] video: fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe() Date: Sun, 4 Jun 2023 17:42:28 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767788083429869097?= X-GMAIL-MSGID: =?utf-8?q?1767788083429869097?= If 'mipid_detect()' fails, we must free 'md' to avoid a memory leak. Fixes: 66d2f99d0bb5 ("omapfb: add support for MIPI-DCS compatible LCDs") Signed-off-by: Christophe JAILLET --- drivers/video/fbdev/omap/lcd_mipid.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/omap/lcd_mipid.c b/drivers/video/fbdev/omap/lcd_mipid.c index e4a7f0b824ff..a0fc4570403b 100644 --- a/drivers/video/fbdev/omap/lcd_mipid.c +++ b/drivers/video/fbdev/omap/lcd_mipid.c @@ -571,11 +571,15 @@ static int mipid_spi_probe(struct spi_device *spi) r = mipid_detect(md); if (r < 0) - return r; + goto free_md; omapfb_register_panel(&md->panel); return 0; + +free_md: + kfree(md); + return r; } static void mipid_spi_remove(struct spi_device *spi)