Imagine that you have mapped an 8-bit register bank to a peripheral chip (via the devm_ioremap_resource() API in your driver's xxx_probe() method; assume it succeeds). Now, you want to read the current content in the third 8-bit register. The following is some (pseudo)code that you can use to do this. Study it and spot the bug inside it:
char val;
void __iomem *base = devm_ioremap_resource(dev, r);
[...]
val = ioread8(base+3);
Can you suggest a fix?
Possible solution to this exercise can be found at https://github.com/PacktPublishing/Linux-Kernel-Programming-Part-2/tree/main/solutions_to_assgn.