diff mbox series

[RFT,08/16] memory: omap-gpmc: Use WARN() instead of BUG() on wrong free

Message ID 20200724182328.3348-9-krzk@kernel.org (mailing list archive)
State New, archived
Headers show
Series memory: Further cleanups | expand

Commit Message

Krzysztof Kozlowski July 24, 2020, 6:23 p.m. UTC
Since driver tracks reserved memory, freeing a non-reserved GPMC should
not be fatal and crash the system.  Printing a warning is friendlier.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Not tested on HW.
---
 drivers/memory/omap-gpmc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Krzysztof Kozlowski Aug. 17, 2020, 6:36 p.m. UTC | #1
On Fri, Jul 24, 2020 at 08:23:20PM +0200, Krzysztof Kozlowski wrote:
> Since driver tracks reserved memory, freeing a non-reserved GPMC should
> not be fatal and crash the system.  Printing a warning is friendlier.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> 
> ---
> 
> Not tested on HW.
> ---
>  drivers/memory/omap-gpmc.c | 3 +--

Applied.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 9339a7c75fdd..414bfb481266 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -1072,8 +1072,7 @@  void gpmc_cs_free(int cs)
 
 	spin_lock(&gpmc_mem_lock);
 	if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) {
-		printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
-		BUG();
+		WARN(1, "Trying to free non-reserved GPMC CS%d\n", cs);
 		spin_unlock(&gpmc_mem_lock);
 		return;
 	}