[PATCH] misc: sram: remove duplicated resource handling code

Ahmad Fatoum ahmad at a3f.at
Sat Dec 11 00:44:06 PST 2021


Remove superfluous code. No functional change.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 drivers/misc/sram.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index d45b5cb72f93..f4a7551fc760 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -26,24 +26,17 @@ static int sram_probe(struct device_d *dev)
 {
 	struct resource *iores;
 	struct sram *sram;
-	struct resource *res;
-	void __iomem *base;
 	int ret;
 
 	iores = dev_request_mem_resource(dev, 0);
 	if (IS_ERR(iores))
 		return PTR_ERR(iores);
-	base = IOMEM(iores->start);
 
 	sram = xzalloc(sizeof(*sram));
 
 	sram->cdev.name = basprintf("sram%d", cdev_find_free_index("sram"));
 
-	res = dev_get_resource(dev, IORESOURCE_MEM, 0);
-	if (IS_ERR(res))
-		return PTR_ERR(res);
-
-	sram->cdev.size = (unsigned long)resource_size(res);
+	sram->cdev.size = (unsigned long)resource_size(iores);
 	sram->cdev.ops = &memops;
 	sram->cdev.dev = dev;
 
-- 
2.33.0




More information about the barebox mailing list