2017-12-15 10:53:49

by Colin King

[permalink] [raw]
Subject: [PATCH] drm/amd/display: remove redundant null check of array 'data'

From: Colin Ian King <[email protected]>

The null check on aconnector->base.edid_blob_ptr->data is redundant
since data is an array and can never be null. Remove it.

Detected by CoverityScan, CID#1460369 ("Array compared against 0")

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index ccbf10e3bbb6..c388778dbba3 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2725,8 +2725,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
};
struct edid *edid;

- if (!aconnector->base.edid_blob_ptr ||
- !aconnector->base.edid_blob_ptr->data) {
+ if (!aconnector->base.edid_blob_ptr) {
DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
aconnector->base.name);

--
2.14.1


2017-12-15 12:19:02

by Christian König

[permalink] [raw]
Subject: Re: [PATCH] drm/amd/display: remove redundant null check of array 'data'

Am 15.12.2017 um 11:53 schrieb Colin King:
> From: Colin Ian King <[email protected]>
>
> The null check on aconnector->base.edid_blob_ptr->data is redundant
> since data is an array and can never be null. Remove it.
>
> Detected by CoverityScan, CID#1460369 ("Array compared against 0")
>
> Signed-off-by: Colin Ian King <[email protected]>

Acked-by: Christian König <[email protected]>

> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index ccbf10e3bbb6..c388778dbba3 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2725,8 +2725,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
> };
> struct edid *edid;
>
> - if (!aconnector->base.edid_blob_ptr ||
> - !aconnector->base.edid_blob_ptr->data) {
> + if (!aconnector->base.edid_blob_ptr) {
> DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
> aconnector->base.name);
>

2017-12-15 15:05:53

by Harry Wentland

[permalink] [raw]
Subject: Re: [PATCH] drm/amd/display: remove redundant null check of array 'data'

On 2017-12-15 05:53 AM, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> The null check on aconnector->base.edid_blob_ptr->data is redundant
> since data is an array and can never be null. Remove it.
>
> Detected by CoverityScan, CID#1460369 ("Array compared against 0")
>
> Signed-off-by: Colin Ian King <[email protected]>

Reviewed-by: Harry Wentland <[email protected]>

Harry

> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index ccbf10e3bbb6..c388778dbba3 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -2725,8 +2725,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
> };
> struct edid *edid;
>
> - if (!aconnector->base.edid_blob_ptr ||
> - !aconnector->base.edid_blob_ptr->data) {
> + if (!aconnector->base.edid_blob_ptr) {
> DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
> aconnector->base.name);
>
>