Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/panel: sitronix-st7789v: improve error handling

Improve error handling in the probe routine, so that probe
defer errors are captured in /sys/kernel/debug/devices_deferred

Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230714013756.1546769-8-sre@kernel.org

authored by

Sebastian Reichel and committed by
Neil Armstrong
bc2aa99b fbad26dc

+12 -11
+12 -11
drivers/gpu/drm/panel/panel-sitronix-st7789v.c
··· 348 348 349 349 static int st7789v_probe(struct spi_device *spi) 350 350 { 351 + struct device *dev = &spi->dev; 351 352 struct st7789v *ctx; 352 353 int ret; 353 354 354 - ctx = devm_kzalloc(&spi->dev, sizeof(*ctx), GFP_KERNEL); 355 + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); 355 356 if (!ctx) 356 357 return -ENOMEM; 357 358 358 359 spi_set_drvdata(spi, ctx); 359 360 ctx->spi = spi; 360 361 361 - drm_panel_init(&ctx->panel, &spi->dev, &st7789v_drm_funcs, 362 + drm_panel_init(&ctx->panel, dev, &st7789v_drm_funcs, 362 363 DRM_MODE_CONNECTOR_DPI); 363 364 364 - ctx->power = devm_regulator_get(&spi->dev, "power"); 365 - if (IS_ERR(ctx->power)) 366 - return PTR_ERR(ctx->power); 365 + ctx->power = devm_regulator_get(dev, "power"); 366 + ret = PTR_ERR_OR_ZERO(ctx->power); 367 + if (ret) 368 + return dev_err_probe(dev, ret, "Failed to get regulator\n"); 367 369 368 - ctx->reset = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_LOW); 369 - if (IS_ERR(ctx->reset)) { 370 - dev_err(&spi->dev, "Couldn't get our reset line\n"); 371 - return PTR_ERR(ctx->reset); 372 - } 370 + ctx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); 371 + ret = PTR_ERR_OR_ZERO(ctx->reset); 372 + if (ret) 373 + return dev_err_probe(dev, ret, "Failed to get reset line\n"); 373 374 374 375 ret = drm_panel_of_backlight(&ctx->panel); 375 376 if (ret) 376 - return ret; 377 + return dev_err_probe(dev, ret, "Failed to get backlight\n"); 377 378 378 379 drm_panel_add(&ctx->panel); 379 380