All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: "Benoît Cousson" <bcousson@baylibre.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Russell King" <linux@arm.linux.org.uk>,
	"Paul Walmsley" <paul@pwsan.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: linux-omap@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	"Pavel Machek" <pavel@ucw.cz>, "Nishanth Menon" <nm@ti.com>,
	"Ivaylo Dimitrov" <ivo.g.dimitrov.75@gmail.com>,
	"Aaro Koskinen" <aaro.koskinen@iki.fi>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Pali Rohár" <pali.rohar@gmail.com>
Subject: [PATCH 01/10] ARM: OMAP2+: Return correct error values from device and hwmod
Date: Thu, 26 Feb 2015 14:49:51 +0100	[thread overview]
Message-ID: <1424958600-18881-2-git-send-email-pali.rohar@gmail.com> (raw)
In-Reply-To: <1424958600-18881-1-git-send-email-pali.rohar@gmail.com>

Without this patch function pm_runtime_get_sync() returns 0 even when some
omap subfunction fails. This patch properly propagate error codes from omap
functions back to caller.

This patch fix problem, when loading omap-aes driver in qemu cause kernel oops.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 arch/arm/mach-omap2/omap_device.c |   30 +++++++++++++++++-------------
 arch/arm/mach-omap2/omap_hwmod.c  |   10 ++++++----
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index be9541e..9fd47a9 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -224,13 +224,13 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
  */
 static int _omap_device_enable_hwmods(struct omap_device *od)
 {
+	int ret = 0;
 	int i;
 
 	for (i = 0; i < od->hwmods_cnt; i++)
-		omap_hwmod_enable(od->hwmods[i]);
+		ret |= omap_hwmod_enable(od->hwmods[i]);
 
-	/* XXX pass along return value here? */
-	return 0;
+	return ret;
 }
 
 /**
@@ -241,13 +241,13 @@ static int _omap_device_enable_hwmods(struct omap_device *od)
  */
 static int _omap_device_idle_hwmods(struct omap_device *od)
 {
+	int ret = 0;
 	int i;
 
 	for (i = 0; i < od->hwmods_cnt; i++)
-		omap_hwmod_idle(od->hwmods[i]);
+		ret |= omap_hwmod_idle(od->hwmods[i]);
 
-	/* XXX pass along return value here? */
-	return 0;
+	return ret;
 }
 
 /* Public functions for use by core code */
@@ -595,18 +595,20 @@ static int _od_runtime_suspend(struct device *dev)
 	int ret;
 
 	ret = pm_generic_runtime_suspend(dev);
+	if (ret)
+		return ret;
 
-	if (!ret)
-		omap_device_idle(pdev);
-
-	return ret;
+	return omap_device_idle(pdev);
 }
 
 static int _od_runtime_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
+	int ret;
 
-	omap_device_enable(pdev);
+	ret = omap_device_enable(pdev);
+	if (ret)
+		return ret;
 
 	return pm_generic_runtime_resume(dev);
 }
@@ -740,7 +742,8 @@ int omap_device_enable(struct platform_device *pdev)
 
 	ret = _omap_device_enable_hwmods(od);
 
-	od->_state = OMAP_DEVICE_STATE_ENABLED;
+	if (ret == 0)
+		od->_state = OMAP_DEVICE_STATE_ENABLED;
 
 	return ret;
 }
@@ -770,7 +773,8 @@ int omap_device_idle(struct platform_device *pdev)
 
 	ret = _omap_device_idle_hwmods(od);
 
-	od->_state = OMAP_DEVICE_STATE_IDLE;
+	if (ret == 0)
+		od->_state = OMAP_DEVICE_STATE_IDLE;
 
 	return ret;
 }
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 92afb72..870e984 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3350,16 +3350,17 @@ int omap_hwmod_enable(struct omap_hwmod *oh)
  */
 int omap_hwmod_idle(struct omap_hwmod *oh)
 {
+	int r;
 	unsigned long flags;
 
 	if (!oh)
 		return -EINVAL;
 
 	spin_lock_irqsave(&oh->_lock, flags);
-	_idle(oh);
+	r = _idle(oh);
 	spin_unlock_irqrestore(&oh->_lock, flags);
 
-	return 0;
+	return r;
 }
 
 /**
@@ -3372,16 +3373,17 @@ int omap_hwmod_idle(struct omap_hwmod *oh)
  */
 int omap_hwmod_shutdown(struct omap_hwmod *oh)
 {
+	int r;
 	unsigned long flags;
 
 	if (!oh)
 		return -EINVAL;
 
 	spin_lock_irqsave(&oh->_lock, flags);
-	_shutdown(oh);
+	r = _shutdown(oh);
 	spin_unlock_irqrestore(&oh->_lock, flags);
 
-	return 0;
+	return r;
 }
 
 /*
-- 
1.7.9.5

  reply	other threads:[~2015-02-26 13:49 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26 13:49 [PATCH 00/10] omap3 crypto fixes Pali Rohár
2015-02-26 13:49 ` Pali Rohár [this message]
2015-05-21 11:44   ` [PATCH 01/10] ARM: OMAP2+: Return correct error values from device and hwmod Pali Rohár
2015-02-26 13:49 ` [PATCH 02/10] ARM: OMAP3: Fix crypto support for HS devices Pali Rohár
2015-02-28 16:24   ` Pavel Machek
2015-05-26 10:54     ` Pali Rohár
2015-05-26 10:54       ` Pali Rohár
2015-06-02 18:36       ` Paul Walmsley
2015-02-26 13:49 ` [PATCH 03/10] crypto: omap-sham: Add support for omap3 devices Pali Rohár
     [not found]   ` <1424958600-18881-4-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-28 16:25     ` Pavel Machek
2015-02-28 16:25       ` Pavel Machek
2015-05-15  9:19       ` Pali Rohár
2015-05-15  9:19         ` Pali Rohár
2015-05-18  4:30         ` Herbert Xu
2015-05-18  4:30           ` Herbert Xu
2015-02-26 13:49 ` [PATCH 04/10] crypto: omap-sham: Check for return value from pm_runtime_get_sync Pali Rohár
2015-02-28 16:39   ` Pavel Machek
2015-03-08 10:01   ` [PATCH v2] " Pali Rohár
2015-03-09 20:52     ` Pavel Machek
2015-05-14 21:40     ` Pali Rohár
2015-05-15  0:15       ` Herbert Xu
2015-05-15  7:02       ` Herbert Xu
2015-05-15  9:20         ` Pali Rohár
2015-02-26 13:49 ` [PATCH 05/10] ARM: dts: omap3 hs: Remove timer12 Pali Rohár
2015-02-28 16:54   ` Pavel Machek
2015-02-26 13:49 ` [PATCH 06/10] ARM: dts: omap3: Add missing dmas for crypto Pali Rohár
     [not found]   ` <1424958600-18881-7-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-28 16:46     ` Pavel Machek
2015-02-28 16:46       ` Pavel Machek
2015-03-16 21:44       ` Tony Lindgren
2015-02-26 13:49 ` [PATCH 07/10] ARM: dts: n9/n950: Enable omap crypto support Pali Rohár
2015-02-26 13:49   ` Pali Rohár
2015-02-27 15:43   ` Tony Lindgren
2015-02-27 16:01     ` Pali Rohár
2015-02-27 16:10       ` Tony Lindgren
2015-02-27 16:10         ` Tony Lindgren
2015-02-28 16:41   ` Pavel Machek
2015-03-19 16:43     ` Tony Lindgren
2015-03-19 16:43       ` Tony Lindgren
2015-02-26 13:49 ` [PATCH 08/10] ARM: dts: n900: Enable omap sham and include directly omap34xx.dtsi Pali Rohár
2015-02-28 16:44   ` Pavel Machek
2015-02-26 13:49 ` [PATCH 09/10] ARM: dts: omap3-tao3530: Include " Pali Rohár
2015-02-28 16:44   ` Pavel Machek
2015-02-26 13:50 ` [PATCH 10/10] ARM: dts: Remove files omap34xx-hs.dtsi and omap36xx-hs.dtsi Pali Rohár
     [not found]   ` <1424958600-18881-11-git-send-email-pali.rohar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-28 16:45     ` Pavel Machek
2015-02-28 16:45       ` Pavel Machek
2015-02-26 22:46 ` [PATCH 00/10] omap3 crypto fixes Aaro Koskinen
2015-02-27 12:40   ` Pali Rohár
2015-03-07 23:19     ` Aaro Koskinen
2015-03-07 23:19       ` Aaro Koskinen
2015-03-06 18:36 ` Tony Lindgren
2015-03-06 18:36   ` Tony Lindgren
     [not found]   ` <20150306183631.GA13520-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-03-06 19:16     ` Pali Rohár
2015-03-06 19:16       ` Pali Rohár
2015-03-06 19:18       ` Tony Lindgren
2015-03-06 22:23   ` Aaro Koskinen
     [not found]     ` <20150306222306.GB587-+UqvGBo8NkiJ/SmVcN9c7yH8jP4CeeTLqBW4ids5wwA@public.gmane.org>
2015-03-08 10:01       ` Pali Rohár
2015-03-08 10:01         ` Pali Rohár
2015-03-08 16:35         ` Paul Walmsley
2015-03-08 16:35           ` Paul Walmsley
2015-03-15  9:59           ` Pali Rohár
2015-05-14 21:17     ` Pali Rohár
2015-05-14 21:34       ` Tony Lindgren
     [not found]         ` <20150514213418.GP15563-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-05-14 21:39           ` Pali Rohár
2015-05-14 21:39             ` Pali Rohár
2015-05-14 22:03             ` Tony Lindgren
2015-05-14 22:03               ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424958600-18881-2-git-send-email-pali.rohar@gmail.com \
    --to=pali.rohar@gmail.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=bcousson@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nm@ti.com \
    --cc=paul@pwsan.com \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.