Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp49768pxb; Mon, 13 Sep 2021 12:36:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH6Ya8ocaqE2OBP1zTngbQIx9kH07sPearhCX3+mwALmOgj1vUOGDhOXWAkfWqr6aCj3rS X-Received: by 2002:a17:906:c249:: with SMTP id bl9mr14569564ejb.225.1631561798863; Mon, 13 Sep 2021 12:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631561798; cv=none; d=google.com; s=arc-20160816; b=A8OiTXA4oAKNg6NQ3yasFqFgYSO0tJCIxT2IAG1uaiw3UcAjZKmWiAVaY3jnpr3/0j bfRN4dd20i93X+EgfX8m8adgb1Oii9nTH5Y9WpX9vpf7VbHUWmB0HiPPUc2WrQk06exK X12os5Hmc9RJtlxDIoE9820TsQ5RlFxAq7FOnLAwgqQJA7iweWenlGx9DLDUPYGl9nk4 9fBf8pj2WfH9wAodJRQkS2m87IcCaO+dALECQEAt/qKnA3Zx3h6YO0RMgFeUBuAasD26 FMaVSrSOXI2L+ZVxg9WNZHQTp8TwJMmXN65WI7rtJST1NdJbT7CF0qTXzo5R6HWa9Yfd Lvjg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MkkoIsBQeYQhat6x34WXloQf5IpFLGQtaeq5KcZjvos=; b=xDSR3YdrbnTtHpT1zucBZC/qVnuCOSIENHcrcxeHNw9qKdUcTX7AwTq5rH1bPogy4G TyJ1LfRrrgnlarb7OOkfueLgFvAWDM/rJRyT/RfaRjlOK0YCJGxyQYElXM17ub7RHEpV PFFGOkH0TU0HYgqTHHYoOAm0vNKuMWLu/dd5yOq27FC5c4xYwltAnB9YEj4fBp9C1jV5 7cuw7VXsK1tsKp4+MwC/CJ14I7Q8HKCUhV/k4aGVSgsB2+0s9TkTbogqSuiVE3t2Ihc9 ZBt3HLav/c8aMGMxVykd9yYb/NhiFCCXlIYZHSaqBWCwSB/m+eytnVXCiVKFJsXFyMP+ juVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YvPd4k+3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx11si2908801ejc.521.2021.09.13.12.36.15; Mon, 13 Sep 2021 12:36:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YvPd4k+3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243196AbhIMNiZ (ORCPT + 99 others); Mon, 13 Sep 2021 09:38:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:33598 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241583AbhIMNdB (ORCPT ); Mon, 13 Sep 2021 09:33:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D129A6137C; Mon, 13 Sep 2021 13:26:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539570; bh=lVDVoa1sP9R2MLoIob+fd5qtkGB87avFrZ2575JGRtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YvPd4k+3FJxz6/WnF3v0hfpUaY7LSC/mSaNvudQsONJIqF+4hyzNervknrh1ukqcz c7RA2zbDP0ee4WEyxD3ClTUsdBLW3bytq6nZWbFWk0rnmYctXNKKRlwbVhAtwz4zPp /jtm8JmtXoZB2rjql2Tma7+5aDeZTfXKgFbLM5WQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Daniel Vetter , Sasha Levin Subject: [PATCH 5.10 076/236] drm/of: free the right object Date: Mon, 13 Sep 2021 15:13:01 +0200 Message-Id: <20210913131102.949560582@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Lawall [ Upstream commit b557a5f8da5798d27370ed6b73e673aae33efd55 ] There is no need to free a NULL value. Instead, free the object that is leaking due to the iterator. The semantic patch that finds this problem is as follows: // @@ expression x,e; identifier f; @@ x = f(...); if (x == NULL) { ... when any when != x = e * of_node_put(x); ... } // Fixes: 6529007522de ("drm: of: Add drm_of_lvds_get_dual_link_pixel_order") Signed-off-by: Julia Lawall Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20210709200717.3676376-1-Julia.Lawall@inria.fr Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index ca04c34e8251..197c57477344 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -315,7 +315,7 @@ static int drm_of_lvds_get_remote_pixels_type( remote_port = of_graph_get_remote_port(endpoint); if (!remote_port) { - of_node_put(remote_port); + of_node_put(endpoint); return -EPIPE; } -- 2.30.2