linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/11] dma: mv_xor: fix error handling for clocks
Date: Sun,  6 Jan 2013 11:10:44 +0100	[thread overview]
Message-ID: <1357467044-4914-12-git-send-email-andrew@lunn.ch> (raw)
In-Reply-To: <1357467044-4914-1-git-send-email-andrew@lunn.ch>

From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

When a channel fails to initialize, we release all ressources,
including clocks. However, a XOR unit is not necessarily associated to
a clock (some variants of Marvell SoCs have a clock for XOR units,
some don't), so we shouldn't unconditionally be releasing the clock.

Instead, just like we do in the mv_xor_remove() function, we should
check if one clock was found before releasing it.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 drivers/dma/mv_xor.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index cc5d23d..e17fad0 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1366,8 +1366,11 @@ err_channel_add:
 				irq_dispose_mapping(xordev->channels[i]->irq);
 		}
 
-	clk_disable_unprepare(xordev->clk);
-	clk_put(xordev->clk);
+	if (!IS_ERR(xordev->clk)) {
+		clk_disable_unprepare(xordev->clk);
+		clk_put(xordev->clk);
+	}
+
 	return ret;
 }
 
-- 
1.7.10.4

  parent reply	other threads:[~2013-01-06 10:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-06 10:10 [PATCH 00/11] Fixes for 3.8-rc Andrew Lunn
2013-01-06 10:10 ` [PATCH 01/11] ARM: Kirkwood: Fix missing clk for USB device Andrew Lunn
2013-01-07 15:11   ` Simon Guinot
2013-01-07 15:27     ` Andrew Lunn
2013-01-06 10:10 ` [PATCH 02/11] Power: gpio-poweroff: Fix documentation and gpio_is_valid Andrew Lunn
2013-01-06 10:10 ` [PATCH 03/11] ARM: Kirkwood: Switch TWSI1 of 88f6282 to DT clock providers Andrew Lunn
2013-01-06 10:10 ` [PATCH 04/11] ARM: Kirkwood: Fix missing sdio clock Andrew Lunn
2013-01-06 10:10 ` [PATCH 05/11] ARM: Kirkwood: Use fixed-regulator instead of board gpio call Andrew Lunn
2013-01-06 10:10 ` [PATCH 06/11] clk: mvebu: Remove inappropriate __init tagging Andrew Lunn
2013-01-06 10:10 ` [PATCH 07/11] arm: mvebu: Armada XP MV78230 has two cores, not one Andrew Lunn
2013-01-06 10:10 ` [PATCH 08/11] arm: mvebu: Armada XP MV78230 has only three Ethernet interfaces Andrew Lunn
2013-01-06 10:10 ` [PATCH 09/11] arm: mvebu: Add missing ; for cpu node Andrew Lunn
2013-01-06 10:10 ` [PATCH 10/11] dma: mv_xor: fix error handling of mv_xor_channel_add() Andrew Lunn
2013-01-06 10:10 ` Andrew Lunn [this message]
2013-01-07 13:47 ` [PATCH 00/11] Fixes for 3.8-rc Arnd Bergmann
2013-01-07 13:55   ` Andrew Lunn

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=1357467044-4914-12-git-send-email-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).