Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4242309ybz; Mon, 20 Apr 2020 19:09:33 -0700 (PDT) X-Google-Smtp-Source: APiQypKCRqlm442CHUqOeExyjMpSqRk/bxKHPWSbC4M++WUrf9RFbR8ibbL+dt1xpDFYtduS+GLI X-Received: by 2002:a17:906:5287:: with SMTP id c7mr6244649ejm.141.1587434973179; Mon, 20 Apr 2020 19:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587434973; cv=none; d=google.com; s=arc-20160816; b=wlg2N5EDHhCYaqTctnqpU6ca39QXvd+UAGXBrVY0FaYMTongRk5jWdnvoNr91gXta7 vApz5vsQqMn+qjvqtQ9K7rnJnClTY/TxnIiLlo4bXqGfKB6blXFpPEr8LWG+kTxZ3lke SKq0+PMUpiWTzstnGAnahPJ7kTkmGpdvs4lySp2nB7gtr99yMGQ8slHL982AKo0JFXNQ sQe35RYWXzuyuuNX0duu3vS1mQIcxSEGTJqwT9Wqt4n7oWFr9BF0Gki/norsVOZm1Rpn gP1eFZWxeddzCYO+dFX7roAso7gvUukHKGWiAJtTC7OvIyTg5MA0GQWNiOIUmNT5al0F skSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Zs4DjqpbK6wEw86zasp7WNO1pBouda/0exD5FQGoUF4=; b=OWs9VS5SAK7OsXhEU1aV/TQARjXs+3Llf6bh74Qma/XqPpwX9f8Z/ke3TP5QLihKA+ nnKnk/a/OQYrsf+penKxBeaE4rRHfdLEZSeIYU1WNPATy4YpXyjEbB+D9UEFcXywNNvl 0UdpLNZNuPFef7X6HoXbo1vw2udamkN58Et5baUBafl5eceYGi5A4dvJd4DbIBZFsWcV 9P4TbwWWl2d73o3r3xXISvIqEG+008kc2KwX+39eUMW4HghNd1BvuUPTStmA+aMp9qFQ 5t3sm2vRN/zxGep8mwCnWIokbw9jOkZh03W7hFP9VgkeQCYE6gzTzLiA6tyLR1oLvn9B Pzdw== 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 q25si642338ejb.274.2020.04.20.19.09.08; Mon, 20 Apr 2020 19:09:33 -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 S1726018AbgDUCIG (ORCPT + 99 others); Mon, 20 Apr 2020 22:08:06 -0400 Received: from m176115.mail.qiye.163.com ([59.111.176.115]:63855 "EHLO m176115.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbgDUCIG (ORCPT ); Mon, 20 Apr 2020 22:08:06 -0400 Received: from ubuntu.localdomain (unknown [157.0.31.122]) by m176115.mail.qiye.163.com (Hmail) with ESMTPA id DF450664DB9; Tue, 21 Apr 2020 10:08:02 +0800 (CST) From: Bernard Zhao To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Lyude Paul , Sam Ravnborg , Bernard Zhao , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Andrzej Pietrasiewicz , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH v2] amdgpu: fixes error branch not return errno issue Date: Mon, 20 Apr 2020 19:07:50 -0700 Message-Id: <1587434874-123252-1-git-send-email-bernard@vivo.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587202042-115745-1-git-send-email-bernard@vivo.com> References: <1587202042-115745-1-git-send-email-bernard@vivo.com> X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZSlVOTE5CQkJCTE5JS09PTFlXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Mz46MRw4EjgxGgMvA0IzLE5K TyEKCjdVSlVKTkNMT0hPQ0NITUpNVTMWGhIXVRkeCRUaCR87DRINFFUYFBZFWVdZEgtZQVlKTkxV S1VISlVKSUlZV1kIAVlBT05CSDcG X-HM-Tid: 0a719a7e090d9373kuwsdf450664db9 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 --- Changes since V1: * commit message improve --- 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