mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
dax: alloc_dax() return ERR_PTR(-EOPNOTSUPP) for CONFIG_DAX=n
Change the return value from NULL to PTR_ERR(-EOPNOTSUPP) for
CONFIG_DAX=n to be consistent with the fact that CONFIG_DAX=y
never returns NULL.
This is done in preparation for using cpu_dcache_is_aliasing() in a
following change which will properly support architectures which detect
data cache aliasing at runtime.
Link: https://lkml.kernel.org/r/20240215144633.96437-3-mathieu.desnoyers@efficios.com
Fixes: 4e4ced9379
("dax: Move mandatory ->zero_page_range() check in alloc_dax()")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: kernel test robot <lkp@intel.com>
Cc: Michael Sclafani <dm-devel@lists.linux.dev>
Cc: Mike Snitzer <snitzer@kernel.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
2807c54b38
commit
6d439c18d9
@ -319,6 +319,11 @@ EXPORT_SYMBOL_GPL(dax_alive);
|
||||
* that any fault handlers or operations that might have seen
|
||||
* dax_alive(), have completed. Any operations that start after
|
||||
* synchronize_srcu() has run will abort upon seeing !dax_alive().
|
||||
*
|
||||
* Note, because alloc_dax() returns an ERR_PTR() on error, callers
|
||||
* typically store its result into a local variable in order to check
|
||||
* the result. Therefore, care must be taken to populate the struct
|
||||
* device dax_dev field make sure the dax_dev is not leaked.
|
||||
*/
|
||||
void kill_dax(struct dax_device *dax_dev)
|
||||
{
|
||||
|
@ -88,11 +88,7 @@ static inline void *dax_holder(struct dax_device *dax_dev)
|
||||
static inline struct dax_device *alloc_dax(void *private,
|
||||
const struct dax_operations *ops)
|
||||
{
|
||||
/*
|
||||
* Callers should check IS_ENABLED(CONFIG_DAX) to know if this
|
||||
* NULL is an error or expected.
|
||||
*/
|
||||
return NULL;
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
}
|
||||
static inline void put_dax(struct dax_device *dax_dev)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user