reg kernel function

Hello,

This my serial code.
bool NumberFits(int sudoku[], int i, int j) {
/* place number j in sudoku-field i /
int x, y;
int line;
int squareX, squareY; /
coordinates of subsquare */

x = i % cCount;//col
y = i / cCount;//row

/* checks for equals in rows and columns */
for (line = 0; line < cCount; line ++)// want to parallelise this loop
{
if (sudoku[x + line * cCount] == j) return false;
if (sudoku[line + y * cCount] == j) return false;
}
}

Here is my kernel function for serial code above

“__kernel void NumberFits(int i, int j,int cCount,__global const int *sudoku,__global int *res){”
“int x, y, squareX, squareY,k;”
“x = i % cCount;”
“y = i / cCount;”
“int line=get_global_id(0);”
“if((sudoku[line + y * cCount] == j) || (sudoku[x + line * cCount]==j))”
“{”
“res[0]=0;”
“return;”
“}”
“res[0]=1;”
“return;”
“}”

But res[0] is getting overwritten
is there any bug in this kernel function??