Skip to content

Commit f836f20

Browse files
committed
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 7a05254 commit f836f20

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

@@ -465,7 +465,7 @@ int cfb_framebuffer_finalize(const struct device *dev)
465465
struct display_buffer_descriptor desc;
466466
int err;
467467

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

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

0 commit comments

Comments
 (0)