Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707167

[PATCH 2/4] drivers: soc: sunxi: fix error processing on base address when claiming

From Icenowy Zheng <icenowy@aosc.io>
Newsgroups linux.kernel
Subject [PATCH 2/4] drivers: soc: sunxi: fix error processing on base address when claiming
Date 2017-08-09 11:00 +0200
Message-ID <ucv0n-4EV-29@gated-at.bofh.it> (permalink)
References <ucv0l-4EV-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When claiming SRAM, if the base is set to an error, it means that the
SRAM controller has been probed, but failed to remap the controller
memory zone. If the base is zero, thus the SRAM controller should be not
probed at all, and it should return -EPROBE_DEFER. However, currently we
returned -EPROBE_DEFER in the former situation, and ignored the latter
situation (which will lead to the kernel to panic).

Fix the behavior on abnormal base address processing when claiming.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/soc/sunxi/sunxi_sram.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
index 99e354c8f53f..c1ff7fa62cb4 100644
--- a/drivers/soc/sunxi/sunxi_sram.c
+++ b/drivers/soc/sunxi/sunxi_sram.c
@@ -190,6 +190,9 @@ int sunxi_sram_claim(struct device *dev)
 	u32 val, mask;
 
 	if (IS_ERR(base))
+		return PTR_ERR(base);
+
+	if (!base)
 		return -EPROBE_DEFER;
 
 	if (!dev || !dev->of_node)
-- 
2.13.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] Allwinner A64 SRAM C (DE2 SRAM) support Icenowy Zheng <icenowy@aosc.io> - 2017-08-09 11:00 +0200
  [PATCH 2/4] drivers: soc: sunxi: fix error processing on base address when claiming Icenowy Zheng <icenowy@aosc.io> - 2017-08-09 11:00 +0200
    Re: [linux-sunxi] [PATCH 2/4] drivers: soc: sunxi: fix error  processing on base address when claiming Chen-Yu Tsai <wens@csie.org> - 2017-08-09 11:20 +0200

csiph-web