Skip to content

Commit f7de44d

Browse files
JarmouniAcarlescufi
authored andcommitted
drivers: display: stm32_ltdc: fix return value
Blanking On/Off calls should not return 0 when there is no panel controller to forward them to, instead they should return ENOSYS to signal to the application that they were not actually executed. "device_is_ready" does check for null, but also for "dev->state->initialized == false", so we need to isolate the "dev == NULL" case. Signed-off-by: Abderrahmane Jarmouni <git@jarmouni.me>
1 parent 26d75ab commit f7de44d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/display/display_stm32_ltdc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,10 @@ static int stm32_ltdc_display_blanking_off(const struct device *dev)
254254
const struct display_stm32_ltdc_config *config = dev->config;
255255
const struct device *display_dev = config->display_controller;
256256

257+
/* Panel controller's phandle is not passed to LTDC in devicetree */
257258
if (display_dev == NULL) {
258-
return 0;
259+
LOG_ERR("There is no panel controller to forward blanking_off call to");
260+
return -ENOSYS;
259261
}
260262

261263
if (!device_is_ready(display_dev)) {
@@ -271,8 +273,10 @@ static int stm32_ltdc_display_blanking_on(const struct device *dev)
271273
const struct display_stm32_ltdc_config *config = dev->config;
272274
const struct device *display_dev = config->display_controller;
273275

276+
/* Panel controller's phandle is not passed to LTDC in devicetree */
274277
if (display_dev == NULL) {
275-
return 0;
278+
LOG_ERR("There is no panel controller to forward blanking_on call to");
279+
return -ENOSYS;
276280
}
277281

278282
if (!device_is_ready(config->display_controller)) {

0 commit comments

Comments
 (0)