[PATCH 2/3] mtd: move zero length verification to MTD API functions
shmulik.ladkani at gmail.com
Wed Feb 8 09:54:37 EST 2012
On Wed, 08 Feb 2012 15:26:38 +0200 Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> I guess we can go a bit further and sanitize 'mtd_point()' like this:
> From: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
> Date: Wed, 8 Feb 2012 15:13:26 +0200
> Subject: [PATCH] mtd: harmonize mtd_point interface implementation
> Some MTD drivers return -EINVAL if the 'phys' parameter is not NULL, trying to
> convey that they cannot return the physical address. However, this is not very
> logical because they still can return the virtual address ('virt'). But some
> drivers (lpddr) just ignore the 'phys' parameter instead, which is a more
> logical thing to do.
> Let's harmonize this and:
> 1. Always initialize 'virt' and 'phys' to 'NULL' in 'mtd_point()'.
> 2. Do not return an error if the physical address cannot be found.
> So as a result, all drivers will set 'phys' to 'NULL' if it is not supported.
> None of the 'mtd_point()' users use 'phys' anyway, so this should not break
> anything. I guess we could also just delete this parameter later.
According to a98889f3, it makes some sense to return an error when users
explicitly asked for the 'phys' but driver is unable to return it.
I guess new interface (checking the returned 'phys') is reasonable as
well. And, nothing gets broken since no such users...
Reviewed-by: shmulik.ladkani at gmail.com
More information about the linux-mtd