From patchwork Mon Apr 24 18:14:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 9696901 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 44CDE603F2 for ; Mon, 24 Apr 2017 18:14:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F79B28404 for ; Mon, 24 Apr 2017 18:14:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 345B52841C; Mon, 24 Apr 2017 18:14:45 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 DE93028404 for ; Mon, 24 Apr 2017 18:14:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S975693AbdDXSOl (ORCPT ); Mon, 24 Apr 2017 14:14:41 -0400 Received: from mail.kernel.org ([198.145.29.136]:34962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S975695AbdDXSOg (ORCPT ); Mon, 24 Apr 2017 14:14:36 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2836020173; Mon, 24 Apr 2017 18:14:35 +0000 (UTC) Received: from CookieMonster.cookiemonster.local (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66C2A20172; Mon, 24 Apr 2017 18:14:33 +0000 (UTC) From: Kieran Bingham To: niklas.soderlund@ragnatech.se Cc: linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org, Kieran Bingham Subject: [PATCH 2/2] rcar-vin: group: use correct of_node Date: Mon, 24 Apr 2017 19:14:26 +0100 Message-Id: <1493057666-27961-1-git-send-email-kbingham@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20170314190308.25790-1-niklas.soderlund+renesas@ragnatech.se> References: <20170314190308.25790-1-niklas.soderlund+renesas@ragnatech.se> X-Virus-Scanned: ClamAV using ClamSMTP 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 From: Kieran Bingham The unbind function dereferences the subdev->dev node to obtain the of_node. In error paths, the subdev->dev can be set to NULL, whilst the correct reference to the of_node is available as subdev->of_node. Correct the dereferencing, and move the variable outside of the loop as it is constant against the subdev, and not initialised per CSI, for both the bind and unbind functions Signed-off-by: Kieran Bingham --- drivers/media/platform/rcar-vin/rcar-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index 48557628e76d..a530dc388b95 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -469,7 +469,7 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, v4l2_set_subdev_hostdata(subdev, vin); - if (vin->digital.asd.match.of.node == subdev->dev->of_node) { + if (vin->digital.asd.match.of.node == subdev->of_node) { /* Find surce and sink pad of remote subdevice */ ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SOURCE); @@ -738,12 +738,11 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier, struct v4l2_async_subdev *asd) { struct rvin_dev *vin = notifier_to_vin(notifier); + struct device_node *del = subdev->of_node; unsigned int i; mutex_lock(&vin->group->lock); for (i = 0; i < RVIN_CSI_MAX; i++) { - struct device_node *del = subdev->dev->of_node; - if (vin->group->bridge[i].asd.match.of.node == del) { vin_dbg(vin, "Unbind bridge %s\n", subdev->name); vin->group->bridge[i].subdev = NULL; @@ -768,13 +767,13 @@ static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier, struct v4l2_async_subdev *asd) { struct rvin_dev *vin = notifier_to_vin(notifier); + struct device_node *new = subdev->of_node; unsigned int i; v4l2_set_subdev_hostdata(subdev, vin); mutex_lock(&vin->group->lock); for (i = 0; i < RVIN_CSI_MAX; i++) { - struct device_node *new = subdev->dev->of_node; if (vin->group->bridge[i].asd.match.of.node == new) { vin_dbg(vin, "Bound bridge %s\n", subdev->name);