passing device memory to a void can't pass by reference

hi guys i want to create a matrix from a file in the host, then load that values in the device memory and work with them in a kernel… how can i do it? i’m a noob, and i’m a bit confused…
i got runtime error calling the g_evolve function… probably because from device functions, d_a seems to be not initialized…

from main:

float* d_a; //by specifics, i can’t change that
pass(d_a,problemDimension,functionID);
g_evolve(functionID,d_a);

where:

host void pass (float* d_a, unsigned int problemDimension, unsigned int functionID) {

if (functionID==9) {

float* h_a;
size_t matrixSize = problemDimensionproblemDimensionsizeof(float);
h_a = (float )malloc(matrixSize); //they’re vectors because cudaMemCpy doesn’t work with matrix
matrixLoad(h_a,problemDimension); //load from file
cudaMalloc((void
*)&d_a,matrixSize);
cudaMemcpy(d_a,h_a,matrixSize,cudaMemcpyHostToDevice);
free(h_a)

}

g_init(functionID,d_a);

}

static global void g_init(unsigned int functionID, float* d_a) {

//kernel work with matrix d_a…

}

static global void g_evolve(unsigned int functionID, float* d_a) {

//kernel work with matrix d_a…

}

any help/ideas? i’m really noob to cuda!!!
thanks in advance
Enrico

P.S

i’ve read this thread: The Official NVIDIA Forums | NVIDIA but i still don’t understand