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: 1749991 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 566ECDF2AB for ; Thu, 15 Nov 2012 15:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1768041Ab2KOPg4 (ORCPT ); Thu, 15 Nov 2012 10:36:56 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:42266 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1767900Ab2KOPgz (ORCPT ); Thu, 15 Nov 2012 10:36:55 -0500 Received: by mail-we0-f174.google.com with SMTP id t9so624539wey.19 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=a+eytuxHgfb8W8qz0QhHgwuuD1324a/BW9YScxy4TnrpLG1AbIqz7vqZazTbBneWYD 5mB0c9srggaT2dP7xDllENVZegYpEQp/XeUGKbQZOTTse+LGY6t+uPWVgiIHkHlPCbiK RNSVKQGP+eh0D3wxpJzNSxufO6OZxl02OTPKWMQfYFvE88dBzajSIDRrNlB7VGLrr1HS CD5PpKSvXY0ck/efqyRNvHHOhY9otAXWVRcbnH6hY5zPJSSCwxPHd5P5VSHZa4znIMb7 tInfHgFJI6pSQ58lPwZxSkg33ypO+JOSaKgkDhVLeLvtGuBFZ55JUSTb0tDWcFLM56dn L31A== 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: Cc: , , Ohad Ben-Cohen 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: ALoCoQnM/qBNBOgs2V9JcNBJqxcA0Xm07XYUKf2IoEZhis21Ca2S48nMw1ftwwlNmt+qW/8aEkl+ Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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; }