[RFC] spi: spi-fsl-qspi: fix dev_request_mem_resource() usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is the code from drivers/spi/spi-fsl-qspi.c:

> res = dev_request_mem_resource(dev, 0);
> q->iobase = IOMEM(res->start);
> if (IS_ERR(q->iobase)) {
>         ret = PTR_ERR(q->iobase);
>         goto err_put_ctrl;
> }

res can contain error code (not a pointer)
so we can't use IOMEM(res->start) just after
res = dev_request_mem_resource(dev, 0) call.

Signed-off-by: Antony Pavlov <antonynpavlov@xxxxxxxxx>
---
 drivers/spi/spi-fsl-qspi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index 17e6d1df867..d242035ee00 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -800,15 +800,13 @@ static int fsl_qspi_probe(struct device *dev)
 	spi_controller_set_devdata(ctlr, q);
 
 	/* find the resources */
-	res = dev_request_mem_resource(dev, 0);
-	q->iobase = IOMEM(res->start);
+	q->iobase = dev_request_mem_region(dev, 0);
 	if (IS_ERR(q->iobase)) {
 		ret = PTR_ERR(q->iobase);
 		goto err_put_ctrl;
 	}
 
-	res = dev_request_mem_resource(dev, 1);
-	q->ahb_addr = IOMEM(res->start);
+	q->ahb_addr = dev_platform_get_and_ioremap_resource(dev, 1, &res);
 	if (IS_ERR(q->ahb_addr)) {
 		ret = PTR_ERR(q->ahb_addr);
 		goto err_put_ctrl;
-- 
2.39.0





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux