Skip to content

Commit 8866d95

Browse files
committed
Trailing mistakes.
1 parent 6332595 commit 8866d95

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/gpuarray_buffer_cuda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ static int make_bin(cuda_context *ctx, const strb *ptx, strb *bin, strb *log) {
11521152

11531153
err = cuLinkCreate(sizeof(cujit_opts)/sizeof(cujit_opts[0]),
11541154
cujit_opts, cujit_opt_vals, &st);
1155-
if (ctx->err != CUDA_SUCCESS)
1155+
if (err != CUDA_SUCCESS)
11561156
return error_cuda(ctx->err, "cuLinkCreate", err);
11571157
err = cuLinkAddData(st, CU_JIT_INPUT_PTX, ptx->s, ptx->l,
11581158
"kernel code", 0, NULL, NULL);

src/gpuarray_buffer_opencl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ static gpukernel *cl_newkernel(gpucontext *c, unsigned int count,
896896
}
897897

898898
p = clCreateProgramWithSource(ctx->ctx, count+n, news, newl, &err);
899-
if (ctx->err != CL_SUCCESS) {
899+
if (err != CL_SUCCESS) {
900900
if (n != 0) {
901901
free(news);
902902
free(newl);
@@ -1135,7 +1135,7 @@ static int cl_kernelbin(gpukernel *k, size_t *sz, void **obj) {
11351135
if (res == NULL)
11361136
return error_sys(ctx->err, "malloc");
11371137
err = clGetProgramInfo(p, CL_PROGRAM_BINARIES, sizeof(res), &res, NULL);
1138-
if (ctx->err != CL_SUCCESS) {
1138+
if (err != CL_SUCCESS) {
11391139
free(res);
11401140
return error_cl(ctx->err, "clProgramGetInfo", err);
11411141
}

src/util/error.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ void error_free(error *e) {
2222
int error_set(error *e, int code, const char *msg) {
2323
e->code = code;
2424
strlcpy(e->msg, msg, ERROR_MSGBUF_LEN);
25+
#ifdef DEBUG
26+
fprintf(stderr, "ERROR %d: %s\n", e->code, e->msg);
27+
#endif
2528
return code;
2629
}
2730

@@ -32,5 +35,8 @@ int error_fmt(error *e, int code, const char *fmt, ...) {
3235
va_start(ap, fmt);
3336
vsnprintf(e->msg, ERROR_MSGBUF_LEN, fmt, ap);
3437
va_end(ap);
38+
#ifdef DEBUG
39+
fprintf(stderr, "ERROR %d: %s\n", e->code, e->msg);
40+
#endif
3541
return code;
3642
}

0 commit comments

Comments
 (0)