[2/3] drm/amdgpu: fix compiler warning.

Submitted by Rex Zhu on Sept. 8, 2016, 6:05 a.m.

Details

Message ID 1473314717-28780-2-git-send-email-Rex.Zhu@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Rex Zhu Sept. 8, 2016, 6:05 a.m.
no parentheses around assignment used as truth value.

Change-Id: I6bc4b74d3838a4d0c4c7a1b46c74a5d405e76f4e
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index f17fc6d..d497c11 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1977,7 +1977,8 @@  int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 	if (resume) {
 		pci_set_power_state(dev->pdev, PCI_D0);
 		pci_restore_state(dev->pdev);
-		if (r = pci_enable_device(dev->pdev)) {
+		r = pci_enable_device(dev->pdev);
+		if (r != 0) {
 			if (fbcon)
 				console_unlock();
 			return r;

Comments

On Thu, Sep 08, 2016 at 02:05:16PM +0800, Rex Zhu wrote:
> no parentheses around assignment used as truth value.
> 
> Change-Id: I6bc4b74d3838a4d0c4c7a1b46c74a5d405e76f4e
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>

Reviewed-by: Huang Rui <ray.huang@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index f17fc6d..d497c11 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1977,7 +1977,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
>  	if (resume) {
>  		pci_set_power_state(dev->pdev, PCI_D0);
>  		pci_restore_state(dev->pdev);
> -		if (r = pci_enable_device(dev->pdev)) {
> +		r = pci_enable_device(dev->pdev);
> +		if (r != 0) {
>  			if (fbcon)
>  				console_unlock();
>  			return r;
> -- 
> 1.9.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Rex Zhu

> Sent: Thursday, September 08, 2016 2:05 AM

> To: amd-gfx@lists.freedesktop.org

> Cc: Zhu, Rex

> Subject: [PATCH 2/3] drm/amdgpu: fix compiler warning.

> 

> no parentheses around assignment used as truth value.

> 

> Change-Id: I6bc4b74d3838a4d0c4c7a1b46c74a5d405e76f4e

> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>

> ---

>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

> index f17fc6d..d497c11 100644

> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

> @@ -1977,7 +1977,8 @@ int amdgpu_device_resume(struct drm_device

> *dev, bool resume, bool fbcon)

>  	if (resume) {

>  		pci_set_power_state(dev->pdev, PCI_D0);

>  		pci_restore_state(dev->pdev);

> -		if (r = pci_enable_device(dev->pdev)) {

> +		r = pci_enable_device(dev->pdev);

> +		if (r != 0) {


This can be simplified to just:
if (r) {

With that fixed:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


>  			if (fbcon)

>  				console_unlock();

>  			return r;

> --

> 1.9.1

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx