Hello Andy Shevchenko, The patch 7d84a63a39b7: "backlight: hx8357: Convert to agnostic GPIO API" from Dec 7, 2023 (linux-next), leads to the following Smatch static checker warning: drivers/video/backlight/hx8357.c:612 hx8357_probe() error: potential NULL/IS_ERR bug 'lcd->im_pins' drivers/video/backlight/hx8357.c 580 static int hx8357_probe(struct spi_device *spi) 581 { 582 struct device *dev = &spi->dev; 583 struct lcd_device *lcdev; 584 struct hx8357_data *lcd; 585 const struct of_device_id *match; 586 int i, ret; 587 588 lcd = devm_kzalloc(&spi->dev, sizeof(*lcd), GFP_KERNEL); 589 if (!lcd) 590 return -ENOMEM; 591 592 ret = spi_setup(spi); 593 if (ret < 0) { 594 dev_err(&spi->dev, "SPI setup failed.\n"); 595 return ret; 596 } 597 598 lcd->spi = spi; 599 600 match = of_match_device(hx8357_dt_ids, &spi->dev); 601 if (!match || !match->data) 602 return -EINVAL; 603 604 lcd->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); 605 if (IS_ERR(lcd->reset)) 606 return dev_err_probe(dev, PTR_ERR(lcd->reset), "failed to request reset GPIO\n"); 607 gpiod_set_consumer_name(lcd->reset, "hx8357-reset"); 608 609 lcd->im_pins = devm_gpiod_get_array_optional(dev, "im", GPIOD_OUT_LOW); 610 if (IS_ERR(lcd->im_pins)) 611 return dev_err_probe(dev, PTR_ERR(lcd->im_pins), "failed to request im GPIOs\n"); --> 612 if (lcd->im_pins->ndescs < HX8357_NUM_IM_PINS) ^^^^^^^^^^^^ I think _optional() functions can return NULL. 613 return dev_err_probe(dev, -EINVAL, "not enough im GPIOs\n"); 614 615 for (i = 0; i < HX8357_NUM_IM_PINS; i++) 616 gpiod_set_consumer_name(lcd->im_pins->desc[i], "im_pins"); 617 618 lcdev = devm_lcd_device_register(&spi->dev, "mxsfb", &spi->dev, lcd, 619 &hx8357_ops); 620 if (IS_ERR(lcdev)) { 621 ret = PTR_ERR(lcdev); 622 return ret; 623 } 624 spi_set_drvdata(spi, lcdev); 625 626 hx8357_lcd_reset(lcdev); 627 628 ret = ((int (*)(struct lcd_device *))match->data)(lcdev); 629 if (ret) { 630 dev_err(&spi->dev, "Couldn't initialize panel\n"); 631 return ret; 632 } 633 634 dev_info(&spi->dev, "Panel probed\n"); 635 636 return 0; 637 } regards, dan carpenter