Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp3862655rwr; Sat, 22 Apr 2023 13:51:28 -0700 (PDT) X-Google-Smtp-Source: AKy350ZNKWLcvPoloIVA3IMz1JPkr7CL5LQM0PRZFakMtbSfovn17IRV6+eQ9ETxTfRbx/uieZG0 X-Received: by 2002:a05:6a20:12c8:b0:f2:c9c:6e8b with SMTP id v8-20020a056a2012c800b000f20c9c6e8bmr10979638pzg.3.1682196687804; Sat, 22 Apr 2023 13:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682196687; cv=none; d=google.com; s=arc-20160816; b=trlW7TaPv0h418rpxk8uOdlYk/ATj37dBD2Qzf9/S9mJm5qV0xpKCi6BlYvyuJ4SN0 GM4NM7t6VAmd1NIoLZp40SCE6YbqdXqaELudWtp1JD6EdjjAzv8uYeuQ7jDbiqFjJ9RS Y8iMfJiDu6KJctg0+yacmo8qpakD5iiKjzztRbxRnvQPD2CD76E/BKJpyUtGiPXe6YQ+ D2vv8EmHpMU3BRj5lr7u2JMehjMptDY+Y2Hye+Qs23bKA7a72LLRdHdoek14KNlsWeMf 5ST3uP6YDMx10LhrFhThaOvIMtLIBtu+ddepOps98sMma+4AVo9h9YfBuh8qWZ1GEZ/H 3mZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QYQsMZGotZpVWg8rTk81GK88JprQuu2pHpiP+g4CkgA=; b=lkB3UaJpb4K5O/hYUr2lMBBjc1oEWnMTBAwLby8yoK2Xff2w0KH0RZ9x2u3LLY4jQu UG+Bllx3OcYpcgr0fDOgC07gcaS1OOrWrnmzDkCD8zjOhRDOcCstTLi1T71fao3c3/Yv EvfErR5Ee9kmCty9RB1iMhiijD3nByW/E8hQZctJgeC2vjG9QibRBFXryXq3YTLIbUns pYVkI8qLCNZ32R54lVq6ruPV2hQ/s0PNu9TGcYjYOK2yU/o+HvYgAM7U2qQvIfx5DSXr kktqnapjFl/L+lGvPVHcZBVG/ZQF+pdb6n0qV7FUlNcCNHMQ2HiNOFNIaYtitVHXW04H E54w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BFSTdmqx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q11-20020a631f4b000000b00513af1fa0b5si6983381pgm.797.2023.04.22.13.51.14; Sat, 22 Apr 2023 13:51:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BFSTdmqx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230060AbjDVUuw (ORCPT + 99 others); Sat, 22 Apr 2023 16:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbjDVUud (ORCPT ); Sat, 22 Apr 2023 16:50:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85B8126B2; Sat, 22 Apr 2023 13:50:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E13061537; Sat, 22 Apr 2023 20:50:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55A6BC433EF; Sat, 22 Apr 2023 20:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682196630; bh=gS1hH+6UfTG4eAU2Lxy6lXpSl2LKEs6U01Sva2NM8K0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BFSTdmqxktXIhqaVQuxoxZIM99nWNCOVwcoGznR4cprKjkzJO5pg2Q/268AbMmxBu irvc/NwAS/hJVW4jFaRR+t/GheZ26xD7a1cKXRGMOqA9SOOW2o3JGCpCP+2HHOTBdN zfNT9leHiGN7ynDEGUpS22IvgOJZREPxVKvTESL5wZGibVElapgIfTa61nNvsRaBGD kw4OZ4aOZS50isJpiHTuhS7E/pnjYJRX22z0F6IltRv9Kq+Dwbzz/exHrw1dEaTNiX FMAA39WWEh0uSIV8vEirYQlIpo43mWxUocvEXg7DiZnEvjPGiwoI593lSqkCu03T5k v4NKC3zOgkqTg== Received: by mercury (Postfix, from userid 1000) id 173BA1066CC8; Sat, 22 Apr 2023 22:50:25 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel Cc: Gerald Loacker , Michael Riesch , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH v2 07/13] drm/panel: sitronix-st7789v: improve error handling Date: Sat, 22 Apr 2023 22:50:06 +0200 Message-Id: <20230422205012.2464933-8-sre@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230422205012.2464933-1-sre@kernel.org> References: <20230422205012.2464933-1-sre@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Improve error handling in the probe routine, so that probe defer errors are captured in /sys/kernel/debug/devices_deferred Signed-off-by: Sebastian Reichel --- .../gpu/drm/panel/panel-sitronix-st7789v.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index 6290bd49d055..a6d6155ef45c 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -348,32 +348,33 @@ static const struct drm_panel_funcs st7789v_drm_funcs = { static int st7789v_probe(struct spi_device *spi) { + struct device *dev = &spi->dev; struct st7789v *ctx; int ret; - ctx = devm_kzalloc(&spi->dev, sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; spi_set_drvdata(spi, ctx); ctx->spi = spi; - drm_panel_init(&ctx->panel, &spi->dev, &st7789v_drm_funcs, + drm_panel_init(&ctx->panel, dev, &st7789v_drm_funcs, DRM_MODE_CONNECTOR_DPI); - ctx->power = devm_regulator_get(&spi->dev, "power"); - if (IS_ERR(ctx->power)) - return PTR_ERR(ctx->power); + ctx->power = devm_regulator_get(dev, "power"); + ret = PTR_ERR_OR_ZERO(ctx->power); + if (ret) + return dev_err_probe(dev, ret, "Failed to get regulator\n"); - ctx->reset = devm_gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(ctx->reset)) { - dev_err(&spi->dev, "Couldn't get our reset line\n"); - return PTR_ERR(ctx->reset); - } + ctx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); + ret = PTR_ERR_OR_ZERO(ctx->reset); + if (ret) + return dev_err_probe(dev, ret, "Failed to get reset line\n"); ret = drm_panel_of_backlight(&ctx->panel); if (ret) - return ret; + return dev_err_probe(dev, ret, "Failed to get backlight\n"); drm_panel_add(&ctx->panel); -- 2.39.2