From patchwork Mon Mar 19 16:14:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10293047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 441D6602BD for ; Mon, 19 Mar 2018 16:18:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32E1D29210 for ; Mon, 19 Mar 2018 16:18:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276122922A; Mon, 19 Mar 2018 16:18:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E297129210 for ; Mon, 19 Mar 2018 16:18:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966915AbeCSQSC (ORCPT ); Mon, 19 Mar 2018 12:18:02 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:33983 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966145AbeCSQOt (ORCPT ); Mon, 19 Mar 2018 12:14:49 -0400 Received: by mail-pl0-f67.google.com with SMTP id u11-v6so6857329plq.1 for ; Mon, 19 Mar 2018 09:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=x6IhjSr5alZL6+11mVbA/KLjxw526QfZhpricRfbBWA=; b=L/nBFBorWTOJZ/6CLBXm6YZBHLgsJ9zlc+RtfsLcgx4B3oYLQ42zsh5m8CY6IjGTpb PS8adF8an1I8KxNKReCbquKJgC3sNc54qTKNsi18tW/aC6vA9cwpWdBrtwVs37DvdDzX BwmJLW5uYd0zlrwGtVXFSjLvbK4uboyysHzs9HrezQd5InJVujFggfWYXMmioIR5RTXK xjWPvJO7ny0KzaVLfOY4rKsWb3BS2HwYUyHJdiIft8ynfob+pXU8paob2skE3BmXUQOI b18mbqgAa7iXE4QB5w34tfYFbzA4HDgjWtmkZPnoV9XUnOz+LMOSxvjPz8z5mtHBX/TG M1UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=x6IhjSr5alZL6+11mVbA/KLjxw526QfZhpricRfbBWA=; b=EbTC9MHRLWFWCjq7xE0r4ocjM2T9l3MRgHecllgbyW7GFpp8YdbRHkLl73Mj7nyx1S ciKGBA6Qnyx+oCApuxytcPJurnmAICzZUELwrOs1pQx3V9UbTz3wNjiJiw0BGm/DRJ+6 THNexBZ1MLc/bmUtapXEqvoHpgv4zYkMm/JhbwlDRHwJH7Rh3BEpuIsjqyMJ4YaLu5pn 2gyZUdi7pMf7l1kjl52DnVhIlY2/CSI5CXIZXVms84pUHGLILMDxkjoe8A4Jk9wE9Yc7 BQqm5o6FamDvuBLYQoGA3XYWWPn/lzmK/EFwLPLcOCs37/NMH0wPNgUNy8x+NnpUkAfF O7Zw== X-Gm-Message-State: AElRT7GYPVNKSctQzKOXVoyznZFnEDon9mf3d+UCSHJ1OY2oqZuTvBkS M2ms05EE0a7RCrdIFJx92rSSKA== X-Google-Smtp-Source: AG47ELtgDH/NYOe/OR8NbF9WQWrXvUjzSGHYxcaWpz67P4DoqID/gXcICd4KHi+baINHd/yd7HrVUQ== X-Received: by 2002:a17:902:968a:: with SMTP id n10-v6mr7514318plp.397.1521476088689; Mon, 19 Mar 2018 09:14:48 -0700 (PDT) Received: from localhost.localdomain ([240f:4:c2bc:1:908c:cbd3:e6d3:a23]) by smtp.gmail.com with ESMTPSA id n74sm1139490pfi.21.2018.03.19.09.14.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Mar 2018 09:14:47 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Todor Tomov , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH] media: ov5645: add missing of_node_put() in error path Date: Tue, 20 Mar 2018 01:14:17 +0900 Message-Id: <1521476057-28792-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Todor Tomov Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita Acked-by: Todor Tomov --- drivers/media/i2c/ov5645.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index d28845f..a31fe18 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -1131,13 +1131,14 @@ static int ov5645_probe(struct i2c_client *client, 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;