diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index 0f7d0947df7ebbf75d4cfa42a032c07cb38483d9..ee3a7154c397fca7ec82df00adcb5976d4c78243 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -146,7 +146,7 @@ class Image(_cl._ImageBase):
         if shape is None and hostbuf is not None:
             shape = hostbuf.shape
 
-        if hostbuf is None and not \
+        if hostbuf is not None and not \
                 (flags & (mem_flags.USE_HOST_PTR | mem_flags.COPY_HOST_PTR)):
             from warnings import warn
             warn("'hostbuf' was passed, but no memory flags to make use of it.")