diff mbox series

io-mapping: Indicate mapping failure

Message ID 20200721141641.81112-2-michael.j.ruhl@intel.com (mailing list archive)
State New, archived
Headers show
Series io-mapping: Indicate mapping failure | expand

Commit Message

Michael J. Ruhl July 21, 2020, 2:16 p.m. UTC
Sometimes it is good to know when your mapping failed.

Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about the io-mapping"
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
---
 include/linux/io-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko July 21, 2020, 2:47 p.m. UTC | #1
On Tue, Jul 21, 2020 at 10:16:41AM -0400, Michael J. Ruhl wrote:
> Sometimes it is good to know when your mapping failed.

Can you elaborate...

> Fixes: cafaf14a5d8f ("io-mapping: Always create a struct to hold metadata about the io-mapping"

...especially taking into account that Fixes implies regression / bug?
Michael J. Ruhl July 21, 2020, 3 p.m. UTC | #2
>-----Original Message-----
>From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>Sent: Tuesday, July 21, 2020 10:47 AM
>To: Ruhl, Michael J <michael.j.ruhl@intel.com>
>Cc: dri-devel@lists.freedesktop.org; Andrew Morton <akpm@linux-
>foundation.org>; Mike Rapoport <rppt@linux.ibm.com>; Chris Wilson
><chris@chris-wilson.co.uk>; stable@vger.kernel.org
>Subject: Re: [PATCH] io-mapping: Indicate mapping failure
>
>On Tue, Jul 21, 2020 at 10:16:41AM -0400, Michael J. Ruhl wrote:
>> Sometimes it is good to know when your mapping failed.
>
>Can you elaborate...

Sure, guess I was too glib. 
Mike Rapoport July 21, 2020, 3:06 p.m. UTC | #3
On Tue, Jul 21, 2020 at 03:00:41PM +0000, Ruhl, Michael J wrote:
> >-----Original Message-----
> >From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >Sent: Tuesday, July 21, 2020 10:47 AM
> >To: Ruhl, Michael J <michael.j.ruhl@intel.com>
> >Cc: dri-devel@lists.freedesktop.org; Andrew Morton <akpm@linux-
> >foundation.org>; Mike Rapoport <rppt@linux.ibm.com>; Chris Wilson
> ><chris@chris-wilson.co.uk>; stable@vger.kernel.org
> >Subject: Re: [PATCH] io-mapping: Indicate mapping failure
> >
> >On Tue, Jul 21, 2020 at 10:16:41AM -0400, Michael J. Ruhl wrote:
> >> Sometimes it is good to know when your mapping failed.

I was going to say it's always a good idea ;-)

> >Can you elaborate...
> 
> Sure, guess I was too glib. 
diff mbox series

Patch

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