From: <ge...@op...> - 2025-09-11 20:16:32
|
This is an automated email from Gerrit. "Tomas Vanek <va...@fb...>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9119 -- gerrit commit efdccd77f3329fa6825b7f64d277037f6c4d2692 Author: Tomas Vanek <va...@fb...> Date: Thu Sep 11 22:12:05 2025 +0200 jtag: linuxgpiod: log memory allocation errors Log error in case of NULL calloc() return. Change-Id: I40c5cba5b92cd39e9a8f7e6d420e11afc8747b3e Signed-off-by: Tomas Vanek <va...@fb...> diff --git a/src/jtag/drivers/linuxgpiod.c b/src/jtag/drivers/linuxgpiod.c index 5522d9a736..5def2ff3f8 100644 --- a/src/jtag/drivers/linuxgpiod.c +++ b/src/jtag/drivers/linuxgpiod.c @@ -52,8 +52,10 @@ static struct gpiod_line_settings *gpiod_line_settings_new(void) struct gpiod_line_settings *rv; rv = calloc(sizeof(struct gpiod_line_settings), 1); - if (!rv) + if (!rv) { + LOG_ERROR("No memory for gpiod line settings"); return NULL; + } return rv; } @@ -128,8 +130,10 @@ static struct gpiod_line_config *gpiod_line_config_new(void) struct gpiod_line_config *rv; rv = calloc(sizeof(struct gpiod_line_config), 1); - if (!rv) + if (!rv) { + LOG_ERROR("No memory for gpiod line config"); return NULL; + } return rv; } @@ -159,8 +163,10 @@ static struct gpiod_request_config *gpiod_request_config_new(void) struct gpiod_request_config *rv; rv = calloc(sizeof(struct gpiod_request_config), 1); - if (!rv) + if (!rv) { + LOG_ERROR("No memory for gpiod request config"); return NULL; + } return rv; } @@ -194,8 +200,10 @@ static struct gpiod_line_request *gpiod_chip_request_lines(struct gpiod_chip *ch assert(req_cfg); line_req = calloc(sizeof(struct gpiod_line_request), 1); - if (!line_req) + if (!line_req) { + LOG_ERROR("No memory for gpiod line request"); return NULL; + } line_req->gpio_line = gpiod_chip_get_line(chip, line_cfg->gpio_num); if (!line_req->gpio_line) { -- |