2019-10-30 02:05:57

by zhong jiang

[permalink] [raw]
Subject: [PATCH] drm/amd/display: remove redundant null pointer check before kfree

kfree has taken null pointer into account. hence it is safe to remove
the unnecessary check.

Signed-off-by: zhong jiang <[email protected]>
---
drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
index cf6ef38..6f730b5 100644
--- a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
+++ b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
@@ -174,9 +174,7 @@ static bool hdmi_14_process_transaction(
link->ctx,
link,
&i2c_command);
-
- if (buff)
- kfree(buff);
+ kfree(buff);

return result;
}
--
1.7.12.4


2019-10-30 13:37:47

by Harry Wentland

[permalink] [raw]
Subject: Re: [PATCH] drm/amd/display: remove redundant null pointer check before kfree

On 2019-10-29 9:57 p.m., zhong jiang wrote:
> kfree has taken null pointer into account. hence it is safe to remove
> the unnecessary check.
>
> Signed-off-by: zhong jiang <[email protected]>

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

Harry

> ---
> drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> index cf6ef38..6f730b5 100644
> --- a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> +++ b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> @@ -174,9 +174,7 @@ static bool hdmi_14_process_transaction(
> link->ctx,
> link,
> &i2c_command);
> -
> - if (buff)
> - kfree(buff);
> + kfree(buff);
>
> return result;
> }
>

2019-10-30 13:57:59

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drm/amd/display: remove redundant null pointer check before kfree

On Wed, Oct 30, 2019 at 9:36 AM Harry Wentland <[email protected]> wrote:
>
> On 2019-10-29 9:57 p.m., zhong jiang wrote:
> > kfree has taken null pointer into account. hence it is safe to remove
> > the unnecessary check.
> >
> > Signed-off-by: zhong jiang <[email protected]>
>
> Reviewed-by: Harry Wentland <[email protected]>
>

Applied. thanks!

Alex

> Harry
>
> > ---
> > drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> > index cf6ef38..6f730b5 100644
> > --- a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> > +++ b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> > @@ -174,9 +174,7 @@ static bool hdmi_14_process_transaction(
> > link->ctx,
> > link,
> > &i2c_command);
> > -
> > - if (buff)
> > - kfree(buff);
> > + kfree(buff);
> >
> > return result;
> > }
> >
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel