Re: [PATCH v1] io-mapping: Indicate mapping failure

2020-07-22 Thread Andy Shevchenko
On Tue, Jul 21, 2020 at 11:34:26AM -0400, Michael J. Ruhl wrote:

Thanks for an update, my comments below.

> The !ATOMIC_IOMAP version of io_maping_init_wc will always return
> success, even when the ioremap fails.
> 
> Since the ATOMIC_IOMAP version returns NULL when the init fails, and
> callers check for a NULL return on error this is unexpected.
> 
> Return NULL on ioremap failure.
> 
> Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata 
> about the io-mapping"

Missed parenthesis.

Still not visible why Fixes tag.
Provide also couple of lines of crash and add a paragraph about it.

-- 
With Best Regards,
Andy Shevchenko


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1] io-mapping: Indicate mapping failure

2020-07-21 Thread Michael J. Ruhl
The !ATOMIC_IOMAP version of io_maping_init_wc will always return
success, even when the ioremap fails.

Since the ATOMIC_IOMAP version returns NULL when the init fails, and
callers check for a NULL return on error this is unexpected.

Return NULL on ioremap failure.

Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about 
the io-mapping"
Cc: Andrew Morton 
Cc: Mike Rapoport 
Cc: Andy Shevchenko 
Cc: Chris Wilson 
Cc: sta...@vger.kernel.org
Signed-off-by: Michael J. Ruhl 
---
 include/linux/io-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 0beaa3eba155..5641e06cbcf7 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -118,7 +118,7 @@ io_mapping_init_wc(struct io_mapping *iomap,
iomap->prot = pgprot_noncached(PAGE_KERNEL);
 #endif
 
-   return iomap;
+   return iomap->iomem ? iomap : NULL;
 }
 
 static inline void
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel