From 0dd5235f51fb0eb0b8cef3fed35be39b8a06d7bd Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 8 Feb 2012 15:13:26 +0200 Subject: 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. Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse --- drivers/mtd/mtdcore.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/mtd/mtdcore.c') diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index ead52b38849..b20346e9fec 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -706,6 +706,9 @@ int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, void **virt, resource_size_t *phys) { *retlen = 0; + *virt = NULL; + if (phys) + *phys = 0; if (!mtd->_point) return -EOPNOTSUPP; if (from < 0 || from > mtd->size || len > mtd->size - from) -- cgit v1.2.3-18-g5258