diff options
author | Amber Bhardwaj <amber.bhardwaj10@gmail.com> | 2017-06-16 11:08:42 +0530 |
---|---|---|
committer | Christoph Lipka <clipka@users.noreply.github.com> | 2017-06-16 07:38:42 +0200 |
commit | cf65615d35b7c0d3cae3239c53374d841d9a175d (patch) | |
tree | 16693b958e879a36c737cb50f13fa5b3ae8e7ce2 /src/kpi/dlt-kpi-interrupt.c | |
parent | b91b38534e5276db69ffbf938177c227b01c65ad (diff) | |
download | DLT-daemon-cf65615d35b7c0d3cae3239c53374d841d9a175d.tar.gz |
Input parameter check & Error message modification (#15)
* Update dlt-kpi-process.c
Added input param checking and added return value in non-void functions.
* Update dlt-kpi.c
Added Input param checking and added return values in non-void functions.
* Input parameter check and Error msg modification
Added null pointer checking
Added input parameter checking
Added return values in non-void functions
Added proper error message for debugging purpose
Signed-off-by: amberbhardwaj <amber.bhardwaj10@gmail.com>
Diffstat (limited to 'src/kpi/dlt-kpi-interrupt.c')
-rw-r--r-- | src/kpi/dlt-kpi-interrupt.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/kpi/dlt-kpi-interrupt.c b/src/kpi/dlt-kpi-interrupt.c index c193b70..b8e4e80 100644 --- a/src/kpi/dlt-kpi-interrupt.c +++ b/src/kpi/dlt-kpi-interrupt.c @@ -30,7 +30,7 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level { if(ctx == NULL) { - fprintf(stderr, "dlt_kpi_log_interrupts(): Nullpointer parameter\n"); + fprintf(stderr, "%s: Nullpointer parameter (NULL) !\n",__func__); return DLT_RETURN_WRONG_PARAMETER; } @@ -53,7 +53,7 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level cpu_count++; else if(cpu_count <= 0) { - fprintf(stderr, "dlt_kpi_log_interrupts: Could not parse CPU count\n"); + fprintf(stderr, "%s: Could not parse CPU count !\n",__func__); return DLT_RETURN_ERROR; } else if(strcmp(token, "\n") == 0) @@ -83,7 +83,7 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level long int interrupt_count = strtol(token, &check, 10); if(*check != '\0') { - fprintf(stderr, "dlt_kpi_log_interrupts: Could not parse interrupt count for CPU %d\n", column - 1); + fprintf(stderr, "%s: Could not parse interrupt count for CPU !\n",__func__); return DLT_RETURN_ERROR; } @@ -102,13 +102,13 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level DltContextData ctx_data; if((ret = dlt_user_log_write_start(ctx, &ctx_data, log_level)) < DLT_RETURN_OK) { - fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_start() returned error\n"); + fprintf(stderr, "%s: dlt_user_log_write_start() returned error\n", __func__); return ret; } if((ret = dlt_user_log_write_string(&ctx_data, "IRQ")) < DLT_RETURN_OK) { - fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_string() returned error\n"); + fprintf(stderr, "%s: dlt_user_log_write_string() returned error\n", __func__); return ret; } @@ -120,19 +120,19 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level /* message buffer full, start new one */ if((ret = dlt_user_log_write_finish(&ctx_data)) < DLT_RETURN_OK) { - fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_finish() returned error\n"); + fprintf(stderr, "%s: dlt_user_log_write_finish() returned error\n", __func__); return ret; } if((ret = dlt_user_log_write_start(ctx, &ctx_data, log_level)) < DLT_RETURN_OK) { - fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_start() returned error\n"); + fprintf(stderr, "%s: dlt_user_log_write_start() returned error\n", __func__); return ret; } if((ret = dlt_user_log_write_string(&ctx_data, "IRQ")) < DLT_RETURN_OK) { - fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_string() returned error\n"); + fprintf(stderr, "%s: dlt_user_log_write_string() returned error\n", __func__); return ret; } } @@ -142,7 +142,7 @@ DltReturnValue dlt_kpi_log_interrupts(DltContext *ctx, DltLogLevelType log_level if((ret = dlt_user_log_write_finish(&ctx_data)) < DLT_RETURN_OK) { - fprintf(stderr, "dlt_kpi_log_interrupts(): dlt_user_log_write_finish() returned error\n"); + fprintf(stderr, "%s: dlt_user_log_write_finish() returned error\n", __func__); return ret; } |