spi: spi-fsl-qspi: fix dev_request_mem_resource() usage
Subsystems (2)
RFC 1/1 spi: spi-fsl-qspi: fix dev_request_mem_resource() usage
Here is the code from drivers/spi/spi-fsl-qspi.c:
Quoted 6 lines
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 <[email protected]>
--- drivers/spi/spi-fsl-qspi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/spi/spi-fsl-qspi.c +2 -4
@@ -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;
Signature · 1 line
2.39.0
Sascha Hauer
AppliedQuoted 10 lines · Antony Pavlov
Here is the code from
drivers/spi/spi-fsl-qspi.c:Quoted 6 lines
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; }[...]
Applied, thanks!
[1/1] spi: spi-fsl-qspi: fix dev_request_mem_resource() usage
https://git.pengutronix.de/cgit/barebox/commit/?id=3104ea021aef (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>