drivers: mm: rat: Fix virt and phys NULL checks

Do not check virt being NULL as 0 is a valid address that can be
translated. Phys on the other hand is an output pointer that will be
assigned to and so cannot be NULL, check this instead to prevent a
NULL pointer dereference later.

Note that phys is allowed to be NULL, so this is not an invalid argument.
It can set to NULL when the caller wants to check if a virtual address is
mapped but does not care about the address itself. In that case -EFAULT
should be returned if the virtual address is not mapped, 0 otherwise.
For RAT, all addresses not translated are still valid and mapped as
pass-through, so we always return 0 in this check case.

Signed-off-by: Andrew Davis <afd@ti.com>
1 file changed