Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1509449ybz; Sat, 18 Apr 2020 02:29:41 -0700 (PDT) X-Google-Smtp-Source: APiQypK9UrWRJoHXhBfizacB1N+sZ/qk66mB130Ov5/78XSmc6onIqkiowNi4Ru2fMAznc2LQFFS X-Received: by 2002:aa7:cc88:: with SMTP id p8mr6481512edt.387.1587202181750; Sat, 18 Apr 2020 02:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587202181; cv=none; d=google.com; s=arc-20160816; b=eWaqWlj0P+797oEEd5cGYwLW4QovD75gNCpsRDi5Zr8AZKo9S4DDwliU3nFwaTn97U dy1l9MsyEGX5Q3BGWhJH2X4NQjUssiPb3xfN74Wh2EKtzrabLhAlypw1NVZlCyIESY1o LI8emDgWghaywoHuimkRjSWwWElwp9uJkJaJ3SiEnd4MWCfYcwLHoJhDUYQ9JwTs1SYz 0UgpKRC1YIk8vu+Xon4+wljFu9UpotZAgFD9jEnSP1L6KcmG2CX65z743goPEJHBhM/r K1bxtok43e2pAMf9zKJ73Kgh5EC6wJoG7IhLMPIgQ2TBJExh4+epKZdhOy9vZI1syenj W/mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=QXfmSNZdmLu28456lvGhDTNnhtHf6xWQ2Vz+pnULafk=; b=MnvWdHNND+QZYbE2/VA/bLu9Ce4yPqJuNU/uNXiWzLGR9Nv7rmB6NqYpafPEkaAH0H YkQPT2xooWSGCOg5ajov/+tJq0ZEDJrZzvuUlxySxSVIsCSMAb/2LQM07IHqFG1snOzN dli1tyXQSY5lXAU5CxOXEtjbp1lWZHPNMfJyJ2FCPXgwmgN2rwxxmYniWsMh1DsCH/T4 sXxIXbK2P2ldJCjqwaky+8oB7Njh8LsyEX0VKTxu43GX8D00TRyToQvqN3q/tgYRg3rV i47WsTD57/8X7/vMPH/LrWDLGmfKwwBS+vXkKav1rLI2t18eRpRdFeQArEe84Dxqyjy5 MiZA== 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 ca25si1997069edb.389.2020.04.18.02.29.18; Sat, 18 Apr 2020 02:29:41 -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 S1725958AbgDRJ1u (ORCPT + 99 others); Sat, 18 Apr 2020 05:27:50 -0400 Received: from m176115.mail.qiye.163.com ([59.111.176.115]:31985 "EHLO m176115.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbgDRJ1u (ORCPT ); Sat, 18 Apr 2020 05:27:50 -0400 Received: from ubuntu.localdomain (unknown [157.0.31.122]) by m176115.mail.qiye.163.com (Hmail) with ESMTPA id 959CB6643B5; Sat, 18 Apr 2020 17:27:43 +0800 (CST) From: Bernard Zhao To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Sam Ravnborg , Lyude Paul , Dhinakaran Pandiyan , Neil Armstrong , Andrzej Pietrasiewicz , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Bernard Zhao , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH] amdgpu_connector_set_property, fix error branch not return errno Date: Sat, 18 Apr 2020 02:27:20 -0700 Message-Id: <1587202042-115745-1-git-send-email-bernard@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZSFVCTUxLS0tLS0xNSUJIQllXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Kww6Pio*CDg2Tw0IDD1IKj4v HDIKFFZVSlVKTkNMSUtJS01IQk9KVTMWGhIXVRkeCRUaCR87DRINFFUYFBZFWVdZEgtZQVlKTkxV S1VISlVKSUlZV1kIAVlBT05JSjcG X-HM-Tid: 0a718c9d7de59373kuws959cb6643b5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "if(!encoder)" branch return the same value 0 of the success branch, maybe return -EINVAL is more better. Signed-off-by: Bernard Zhao w --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index f355d9a..1f8c6b4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -474,12 +474,12 @@ static int amdgpu_connector_set_property(struct drm_connector *connector, /* need to find digital encoder on connector */ encoder = amdgpu_connector_find_encoder(connector, DRM_MODE_ENCODER_TMDS); if (!encoder) - return 0; + return -EINVAL; amdgpu_encoder = to_amdgpu_encoder(encoder); if (!amdgpu_encoder->enc_priv) - return 0; + return -EINVAL; dig = amdgpu_encoder->enc_priv; new_coherent_mode = val ? true : false; @@ -494,7 +494,7 @@ static int amdgpu_connector_set_property(struct drm_connector *connector, /* need to find digital encoder on connector */ encoder = amdgpu_connector_find_encoder(connector, DRM_MODE_ENCODER_TMDS); if (!encoder) - return 0; + return -EINVAL; amdgpu_encoder = to_amdgpu_encoder(encoder); @@ -509,7 +509,7 @@ static int amdgpu_connector_set_property(struct drm_connector *connector, /* need to find digital encoder on connector */ encoder = amdgpu_connector_find_encoder(connector, DRM_MODE_ENCODER_TMDS); if (!encoder) - return 0; + return -EINVAL; amdgpu_encoder = to_amdgpu_encoder(encoder); @@ -523,7 +523,7 @@ static int amdgpu_connector_set_property(struct drm_connector *connector, /* need to find digital encoder on connector */ encoder = amdgpu_connector_find_encoder(connector, DRM_MODE_ENCODER_TMDS); if (!encoder) - return 0; + return -EINVAL; amdgpu_encoder = to_amdgpu_encoder(encoder); @@ -537,7 +537,7 @@ static int amdgpu_connector_set_property(struct drm_connector *connector, /* need to find digital encoder on connector */ encoder = amdgpu_connector_find_encoder(connector, DRM_MODE_ENCODER_TMDS); if (!encoder) - return 0; + return -EINVAL; amdgpu_encoder = to_amdgpu_encoder(encoder); @@ -551,7 +551,7 @@ static int amdgpu_connector_set_property(struct drm_connector *connector, /* need to find digital encoder on connector */ encoder = amdgpu_connector_find_encoder(connector, DRM_MODE_ENCODER_TMDS); if (!encoder) - return 0; + return -EINVAL; amdgpu_encoder = to_amdgpu_encoder(encoder); -- 2.7.4