Skip to content

Commit 06e0b2d

Browse files
ndrs-pstnashif
authored andcommitted
fb: cfb: remove unnecessary NULL check and NULL assignment
Since the `fb` pointer is always assigned to `char_fb`, there is no need for a `NULL` check. Additionally, removed setting `fb->buf` to `NULL` in `cfb_framebuffer_init` as it will be overwritten by subsequent operations. Signed-off-by: Pisit Sawangvonganan <[email protected]>
1 parent b7fe2a0 commit 06e0b2d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

subsys/fb/cfb.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ int cfb_framebuffer_clear(const struct device *dev, bool clear_display)
436436
{
437437
const struct char_framebuffer *fb = &char_fb;
438438

439-
if (!fb || !fb->buf) {
439+
if (!fb->buf) {
440440
return -ENODEV;
441441
}
442442

@@ -464,7 +464,7 @@ int cfb_framebuffer_finalize(const struct device *dev)
464464
const struct char_framebuffer *fb = &char_fb;
465465
int err;
466466

467-
if (!fb || !fb->buf) {
467+
if (!fb->buf) {
468468
return -ENODEV;
469469
}
470470

@@ -575,7 +575,6 @@ int cfb_framebuffer_init(const struct device *dev)
575575
fb->ppt = 8U;
576576
fb->pixel_format = cfg.current_pixel_format;
577577
fb->screen_info = cfg.screen_info;
578-
fb->buf = NULL;
579578
fb->kerning = 0;
580579
fb->inverted = false;
581580

0 commit comments

Comments
 (0)