Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1931856imm; Thu, 24 May 2018 03:08:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoS+UL/LsSIUX+c2Vr58HCyBiws9kOvgrfjwnJv4Qr/sXtnsJl+WNKHyo4sztvG+j1gM9FL X-Received: by 2002:a63:b441:: with SMTP id n1-v6mr273021pgu.254.1527156526417; Thu, 24 May 2018 03:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156526; cv=none; d=google.com; s=arc-20160816; b=GJSUTt/vmo4YKTClcYR8g5sxZVBuIVQI95ZoyfaQb3d/5Q76Nk/Yc5lS38rwOMzLeC a6DhU9hSi+pgOVAToD2HG3TZkLAE8sJUPDCVTGKJpQ3k+mKVUvLiy9yj0pinL1KH+WQs Ooq+s8iEcEPpwligwU5C7jkt1Yiy+qIzahA24EFYlBlmi+QfyFk/WJhRNA/riX3kST7k bqgvmlGkLX/GDWXe4MUmD+5cxj9Tfj68nQPfNks+cHDOa1LqTiGA0dkgnn/dK6XXvfOF +Vsq8WXFBkOheWF56zf6hLyRJ4rzMnMLtvPkHIaYhpaUhfXKy1T32JnQcv9n63hlM+n2 fM6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=dIT1LI0FnG8jeZ0km509YJpcqHM0tt441VGrvVQkIGI=; b=f7vM5eVh/cDCq03uk+L53n3mK3owPKIdMlGo/AFz7wPAu9GMKWsS800wWm4cQtYy4l hlJGIcB5jFaLPKEM4u6nJK/AxXlgQ1i1gq83vbcnBUbed8N6Mpv+pt1rkkH5mpMdJHkH 4nDEn8d31nXnWgIL9+FBTSN/RQFl49GHzKyS69kT9dNhhkBfSUTgHYuOjk2uZ/v95FbJ gHohAl4enx4V20+CJUviZVRzO/vs8xDkJA/aMEO/jo3mBodAEl6RftFNMy0OD9iCsreV jpI8oTOjpCGEUjuC29x7xtWwnOolJrbPBQG4O167VDZSZev2KNK4lLrO7GBfsO1oYPiT crTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U+RQT1hY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j12-v6si16898430pgf.294.2018.05.24.03.08.31; Thu, 24 May 2018 03:08:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U+RQT1hY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031764AbeEXKGm (ORCPT + 99 others); Thu, 24 May 2018 06:06:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:55504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031724AbeEXKG3 (ORCPT ); Thu, 24 May 2018 06:06:29 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 18A6020896; Thu, 24 May 2018 10:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156388; bh=GpUP+7jfXpKsXWBbPdF4sdY6wwQnbbZzlltyBvOy/mI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+RQT1hYYkomOJlfij4NC6qYi2LIbJ6WhoAf7BlwDaWwkoNjP00cwTF4xDKQARxq/ DE2dzm7+ILQMqUyWQ1DK/NqTsnTMK7sR+/d9jOjJGSbmDntsq79Swn9WSl8crZ9Qpm Hal6D4z1CIHiEAbPE6JZLH/WExtJA2ChwuwJ1iqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Akinobu Mita , Todor Tomov , Sakari Ailus , Sasha Levin Subject: [PATCH 4.16 134/161] media: ov5645: add missing of_node_put() in error path Date: Thu, 24 May 2018 11:39:19 +0200 Message-Id: <20180524093034.408896200@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Akinobu Mita [ Upstream commit 06fe932307d58108a11c3e603517dd2a73a57b80 ] The device node obtained with of_graph_get_next_endpoint() should be released by calling of_node_put(). But it was not released when v4l2_fwnode_endpoint_parse() failed. This change moves the of_node_put() call before the error check and fixes the issue. Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita Acked-by: Todor Tomov Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/ov5645.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -1131,13 +1131,14 @@ static int ov5645_probe(struct i2c_clien ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint), &ov5645->ep); + + of_node_put(endpoint); + if (ret < 0) { dev_err(dev, "parsing endpoint node failed\n"); return ret; } - of_node_put(endpoint); - if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) { dev_err(dev, "invalid bus type, must be CSI2\n"); return -EINVAL;