From patchwork Thu Nov 15 15:36:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 1750001 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 9D6D5DF2AB for ; Thu, 15 Nov 2012 15:39:34 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TZ1Uz-0007a8-Hy; Thu, 15 Nov 2012 15:37:01 +0000 Received: from mail-wg0-f49.google.com ([74.125.82.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TZ1Uv-0007Zp-3R for linux-arm-kernel@lists.infradead.org; Thu, 15 Nov 2012 15:36:57 +0000 Received: by mail-wg0-f49.google.com with SMTP id gg4so600723wgb.18 for ; Thu, 15 Nov 2012 07:36:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=S+dcXvFVYNagij2iRKMNcAGU3R7nS9ewkTPf1NeyJks=; b=GUpXXfiMscec01isIgOGGNl8+210yaqUL/H7H17amudifegnquOX3757S+keS0ZF/3 O38A2YKop/ch7LhxcmMMEmeag429U62MsYPRQy+CzlXaouJnrifz6U1qknDb5EyTR5L3 diTp0McT5sEBIicr0azPK7cPfeXwH+mJfP8q8jj02rHdukQDCWOg8ChRgLgRm9cYq1p+ oxq1WHf/tujjZfMxTlnYTox4xLhexy9aYdMv5KHYioAnXoFC/7hNdmE8wODPMcb1qvLR kWm0X4KhquOUZub6GBsVL8cniLRjzZK0iGz1OTZ3+GSuluP+OtqdjR4dN6EhsGfXQFy+ Z3VA== Received: by 10.180.76.203 with SMTP id m11mr434306wiw.6.1352993814252; Thu, 15 Nov 2012 07:36:54 -0800 (PST) Received: from localhost.localdomain ([109.186.86.248]) by mx.google.com with ESMTPS id dm3sm7878988wib.3.2012.11.15.07.36.52 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 07:36:53 -0800 (PST) From: Ohad Ben-Cohen To: Subject: [PATCH] remoteproc: fix error path of ->find_vqs Date: Thu, 15 Nov 2012 17:36:48 +0200 Message-Id: <1352993808-23212-1-git-send-email-ohad@wizery.com> X-Mailer: git-send-email 1.7.10.rc3.1067.gb129051 X-Gm-Message-State: ALoCoQn0npwnQByqLn25xRIKLIiUnaXtLfXytNH2YVc6DTPYLULKv+/klOL0t7RfcT9ilcqay/Fd X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121115_103657_280429_01903309 X-CRM114-Status: GOOD ( 12.53 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Ohad Ben-Cohen , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Eliminate an erroneous invocation of rproc_shutdown inside the error path of rproc_virtio_find_vqs. Reported-by: Ido Yariv Signed-off-by: Ohad Ben-Cohen --- drivers/remoteproc/remoteproc_virtio.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index e7a4780..9e198e5 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -120,15 +120,11 @@ static struct virtqueue *rp_find_vq(struct virtio_device *vdev, return vq; } -static void rproc_virtio_del_vqs(struct virtio_device *vdev) +static void __rproc_virtio_del_vqs(struct virtio_device *vdev) { struct virtqueue *vq, *n; - struct rproc *rproc = vdev_to_rproc(vdev); struct rproc_vring *rvring; - /* power down the remote processor before deleting vqs */ - rproc_shutdown(rproc); - list_for_each_entry_safe(vq, n, &vdev->vqs, list) { rvring = vq->priv; rvring->vq = NULL; @@ -137,6 +133,16 @@ static void rproc_virtio_del_vqs(struct virtio_device *vdev) } } +static void rproc_virtio_del_vqs(struct virtio_device *vdev) +{ + struct rproc *rproc = vdev_to_rproc(vdev); + + /* power down the remote processor before deleting vqs */ + rproc_shutdown(rproc); + + __rproc_virtio_del_vqs(vdev); +} + static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs, struct virtqueue *vqs[], vq_callback_t *callbacks[], @@ -163,7 +169,7 @@ static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs, return 0; error: - rproc_virtio_del_vqs(vdev); + __rproc_virtio_del_vqs(vdev); return ret; }