This is for devices who only want to do a vmap of the buffer, isn't it?... it's for the vmap only case, where you might not even have a struct device. Or definitely not a reasonable one, like maybe a faux_bus device or some device on a bus that really doesn't do dma (e.g. spi or i2c), and where hence dma_buf_map_attachment is just something you never ever want to do.
I think we might want to transform obj->import_attach into a union or tagged pointer or something like that, which can cover both cases. And maybe a drm_gem_bo_imported_dma_buf() helper that gives you the dma_buf no matter what if it's imported, or NULL if it's allocated on that drm_device?
Cheers, Sima