diff mbox series

drm/amd/display: remove redundant null pointer check before kfree

Message ID 1572400673-42535-1-git-send-email-zhongjiang@huawei.com (mailing list archive)
State New, archived
Headers show
Series drm/amd/display: remove redundant null pointer check before kfree | expand

Commit Message

zhong jiang Oct. 30, 2019, 1:57 a.m. UTC
kfree has taken null pointer into account. hence it is safe to remove
the unnecessary check.

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

Comments

Harry Wentland Oct. 30, 2019, 1:36 p.m. UTC | #1
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 <zhongjiang@huawei.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

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;
>  }
>
Alex Deucher Oct. 30, 2019, 1:56 p.m. UTC | #2
On Wed, Oct 30, 2019 at 9:36 AM Harry Wentland <hwentlan@amd.com> 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 <zhongjiang@huawei.com>
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>

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
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

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;
 }