Message ID | 20171104061232.5bq5hwr2p2ca2cl7@mwanda (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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. 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 >
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 >>
On Sat, Nov 04, 2017 at 10:16:23AM +0100, walter harms wrote: > > > 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. > Good point. I'll resend. regards, dan carpenter
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])); } for (i = 0; i < pool->base.audio_count; i++) {
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.