mirror of
https://github.com/openocd-org/openocd.git
synced 2025-10-14 02:58:23 +08:00
jtag: linuxgpiod: log memory allocation errors
Log error in case of NULL calloc() return. Change-Id: I40c5cba5b92cd39e9a8f7e6d420e11afc8747b3e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/9119 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
This commit is contained in:

committed by
Antonio Borneo

parent
9e2a11c2f2
commit
32afb0ab04
@@ -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) {
|
||||
|
Reference in New Issue
Block a user