public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: wharms-fPG8STNUNVg@public.gmane.org,
	Dan Carpenter
	<dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
	Harry Wentland <harry.wentland-5C7GfCeVMHo@public.gmane.org>,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Dmytro Laktyushkin
	<Dmytro.Laktyushkin-5C7GfCeVMHo@public.gmane.org>,
	Hersen Wu <hersenxs.wu-5C7GfCeVMHo@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	Yue Hin Lau <Yuehin.Lau-5C7GfCeVMHo@public.gmane.org>,
	Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	Tony Cheng <tony.cheng-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amd/display: indent an if statement
Date: Sat, 04 Nov 2017 10:07:29 +0000	[thread overview]
Message-ID: <e32e3d91-bfdf-5c4b-afb2-2472efeb1079@amd.com> (raw)
In-Reply-To: <59FD8567.4030500-fPG8STNUNVg@public.gmane.org>

Am 04.11.2017 um 10:16 schrieb walter harms:
>
> Am 04.11.2017 07:12, schrieb Dan Carpenter:
>> The if statement wasn't indented so it makes static analysis tools and
>> probably very recent GCC versions complain.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>> I went over 80 characters because other lines do already and it seemed
>> like the cleanest thing here.
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
>> index d911590d08bc..c83ac4d9ca3a 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
>> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
>> @@ -727,7 +727,7 @@ static void destruct(struct dcn10_resource_pool *pool)
>>   
>>   	for (i = 0; i < pool->base.stream_enc_count; i++) {
>>   		if (pool->base.stream_enc[i] != NULL)
>> -		kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
>> +			kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
>>   	}
>>   
> Is that "if (pool->base.stream_enc[i] != NULL)" needed at all ?
> kfree() should happily handle NULL.

Yeah, indeed. The correct solution would be to just drop the "if" as 
well as the "{}".

I would also drop the cast done by DCE110STRENC_FROM_STRENC, cause 
kfree() doesn't care about the type of the pointer.

Regards,
Christian.

>
> re,
>   wh
>
>
>
>>   	for (i = 0; i < pool->base.audio_count; i++) {
>> --
>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>


  parent reply	other threads:[~2017-11-04 10:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-04  6:12 [PATCH] drm/amd/display: indent an if statement Dan Carpenter
2017-11-04  9:16 ` walter harms
     [not found]   ` <59FD8567.4030500-fPG8STNUNVg@public.gmane.org>
2017-11-04 10:07     ` Christian König [this message]
2017-11-06  7:07       ` [PATCH] drm/amd/display: small cleanup in destruct() Dan Carpenter
2017-11-06  8:44         ` Christian König
2017-11-06 21:29           ` Alex Deucher
2017-11-06  6:42   ` [PATCH] drm/amd/display: indent an if statement Dan Carpenter
2018-08-14  9:09 ` Dan Carpenter
     [not found]   ` <20180814090944.qjm4vxyrjdqxu4d7-vMlZ3nK25oGAIHFoDFOv9A@public.gmane.org>
2018-08-21 18:51     ` Harry Wentland
2020-08-03 14:35 ` [PATCH] drm/amd/display: Indent " Dan Carpenter
2020-08-04 20:33   ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e32e3d91-bfdf-5c4b-afb2-2472efeb1079@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Dmytro.Laktyushkin-5C7GfCeVMHo@public.gmane.org \
    --cc=Yuehin.Lau-5C7GfCeVMHo@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=harry.wentland-5C7GfCeVMHo@public.gmane.org \
    --cc=hersenxs.wu-5C7GfCeVMHo@public.gmane.org \
    --cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tony.cheng-5C7GfCeVMHo@public.gmane.org \
    --cc=wharms-fPG8STNUNVg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox