clCreateImage2D USE_HOST_PTR throws INV_IMAGE_FORMAT_DESCRIP


size_t width = 512;
size_t height = 512;
void *image  = (void*) malloc( width *height * sizeof(unsigned int));

cl_image_format imageFormat;
imageFormat.image_channel_data_type = CL_R;
imageFormat.image_channel_order = CL_UNSIGNED_INT32;
cl_int error = CL_SUCCESS;
cl_mem clMemImage = clCreateImage2D(context,CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, &imageFormat, wid, hei, 0, image , &error); 


Also,



size_t width = 512;
size_t height = 512;

void *image  = (void*) malloc( height *height);

cl_image_format imageFormat;
	imageFormat.image_channel_data_type = CL_R;
	imageFormat.image_channel_order = CL_UNSIGNED_INT8;


cl_int error = CL_SUCCESS;
cl_mem clMemImage = clCreateImage2D(context,CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, &imageFormat, wid, hei, 0, image , &error); 


Above code snippets throws CL_INVALID_IMAGE_FORMAT_DESCRIPTOR on AMD OpenCL CPU implementation.

Please help me to find the problem.

sorry for the typos.

void image = (void) malloc( height height);
should be void image = (void) malloc( width
height);

and wid, hei should be weight and height

Please ignore my post, realized the silly mistake