Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1265755pxb; Thu, 16 Sep 2021 03:47:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRvlV8L8ZMdWDDTnhpYkeKI3MyWHOtp1x8viGbOy/WpQlFFgd1WU3gqFY7n79tvUe7N58Y X-Received: by 2002:a05:6e02:154a:: with SMTP id j10mr3539742ilu.79.1631789251832; Thu, 16 Sep 2021 03:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631789251; cv=none; d=google.com; s=arc-20160816; b=TAXHST9BioTEWj8gc7mv6aDVu59RFI2bdiHAKQOLpBxQ1h5VT09axwlaMwYIhm7KCV 3s/kSODo23Olc5OImUhwA1gqIPjrCKbELINw1iNTILM0KjM/uO5KlkuueMGgZNQLL5al RKRG+gaf6q77IHUmBMUdRJ5auNzKXfY7elfPi9q0/oyX8r2d+Hrz0uA6V9IHVs/itu4d vbAHN8ILBJvIKSitPq+C2gmjFruUtwx6jlS5mlR86G++BvJSpP/7FTW3sxfdAjI7uxsm hQKz/VInzVB1gIz/FRemF+p+Tt6O/g7TfHAzokiF9wfuMZq6SluGbQp4aTdzQedufTpb BlCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=uYam2YpVixolO/nZxnl+Dj8ksRAOtqH/iIdgcFnkEAQ=; b=HwraeF2ave58CA24tz83BNyM39oBDO3OuCWHBM8LsKp1JQ+9/CK/CKtQlKJlCSIwEx I7MWSLhoIGQO1DgYU5+AynN/cDCyT9wltV+2RX9Z/T5RQE8PqZIg9YdbdIgX5M4cXth8 TkNbZtv/tOeVr9Mgt/wPH9fkC9BJ6UoXpPcGvYNpkejHpVw7KZ7zUXe1vLGvB6Y1YrNb 5swj9tQG/Mj0pc95FVDg95R/qVE7SmiLM+ztMI/djomDr5GmUHSB/bbfhv7B0wwkkUne +LZtc/fwXZXqUlFznuACJSzFiZ+oSvFSSfUb/8pyGhsitA83KgAO/SD1pHWbAjDn7Jpa LWOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si2169899jaa.114.2021.09.16.03.47.20; Thu, 16 Sep 2021 03:47:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236647AbhIPKrx (ORCPT + 99 others); Thu, 16 Sep 2021 06:47:53 -0400 Received: from mx22.baidu.com ([220.181.50.185]:54452 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236705AbhIPKrt (ORCPT ); Thu, 16 Sep 2021 06:47:49 -0400 Received: from BJHW-Mail-Ex03.internal.baidu.com (unknown [10.127.64.13]) by Forcepoint Email with ESMTPS id DF88F788B45F7BD24C3C; Thu, 16 Sep 2021 18:46:25 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BJHW-Mail-Ex03.internal.baidu.com (10.127.64.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 16 Sep 2021 18:46:25 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 16 Sep 2021 18:46:25 +0800 From: Cai Huoqing To: CC: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , , Subject: [PATCH] drm/panel: nt39016: Make use of the helper function dev_err_probe() Date: Thu, 16 Sep 2021 18:46:19 +0800 Message-ID: <20210916104620.11569-1-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex31.internal.baidu.com (172.31.51.25) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When possible use dev_err_probe help to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file. And using dev_err_probe() can reduce code size, the error value gets printed. Signed-off-by: Cai Huoqing --- drivers/gpu/drm/panel/panel-novatek-nt39016.c | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt39016.c b/drivers/gpu/drm/panel/panel-novatek-nt39016.c index f8151fe3ac9a..d036853db865 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt39016.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt39016.c @@ -258,16 +258,13 @@ static int nt39016_probe(struct spi_device *spi) return -EINVAL; panel->supply = devm_regulator_get(dev, "power"); - if (IS_ERR(panel->supply)) { - dev_err(dev, "Failed to get power supply\n"); - return PTR_ERR(panel->supply); - } + if (IS_ERR(panel->supply)) + return dev_err_probe(dev, PTR_ERR(panel->supply), + "Failed to get power supply\n"); panel->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(panel->reset_gpio)) { - dev_err(dev, "Failed to get reset GPIO\n"); - return PTR_ERR(panel->reset_gpio); - } + if (IS_ERR(panel->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(panel->reset_gpio), "Failed to get reset GPIO\n"); spi->bits_per_word = 8; spi->mode = SPI_MODE_3 | SPI_3WIRE; @@ -287,11 +284,8 @@ static int nt39016_probe(struct spi_device *spi) DRM_MODE_CONNECTOR_DPI); err = drm_panel_of_backlight(&panel->drm_panel); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(dev, "Failed to get backlight handle\n"); - return err; - } + if (err) + return dev_err_probe(dev, err, "Failed to get backlight handle\n"); drm_panel_add(&panel->drm_panel); -- 2.25.1