From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: harry.wentland-5C7GfCeVMHo@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [bug report] drm/amd/dc: Add dc display driver (v2)
Date: Wed, 9 Jan 2019 22:29:43 +0300 [thread overview]
Message-ID: <20190109192943.GA4358@kadam> (raw)
Hello Harry Wentland,
This is a semi-automatic email about new static checker warnings.
The patch 4562236b3bc0: "drm/amd/dc: Add dc display driver (v2)" from
Sep 12, 2017, leads to the following Smatch complaint:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:754 construct()
error: we previously assumed 'dc->current_state' could be null (see line 677)
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c
676
677 if (!dc->current_state) {
^^^^^^^^^^^^^^^^^^
678 dm_error("%s: failed to create validate ctx\n", __func__);
679 goto fail;
^^^^^^^^^
680 }
681
682 /* Create logger */
683
684 dc_ctx->dce_environment = init_params->dce_environment;
685
686 dc_version = resource_parse_asic_id(init_params->asic_id);
687 dc_ctx->dce_version = dc_version;
688
689 /* Resource should construct all asic specific resources.
690 * This should be the only place where we need to parse the asic id
691 */
692 if (init_params->vbios_override)
693 dc_ctx->dc_bios = init_params->vbios_override;
694 else {
695 /* Create BIOS parser */
696 struct bp_init_data bp_init_data;
697
698 bp_init_data.ctx = dc_ctx;
699 bp_init_data.bios = init_params->asic_id.atombios_base_address;
700
701 dc_ctx->dc_bios = dal_bios_parser_create(
702 &bp_init_data, dc_version);
703
704 if (!dc_ctx->dc_bios) {
705 ASSERT_CRITICAL(false);
706 goto fail;
707 }
708
709 dc_ctx->created_bios = true;
710 }
711
712 /* Create I2C AUX */
713 dc_ctx->i2caux = dal_i2caux_create(dc_ctx);
714
715 if (!dc_ctx->i2caux) {
716 ASSERT_CRITICAL(false);
717 goto fail;
718 }
719
720 dc_ctx->perf_trace = dc_perf_trace_create();
721 if (!dc_ctx->perf_trace) {
722 ASSERT_CRITICAL(false);
723 goto fail;
724 }
725
726 /* Create GPIO service */
727 dc_ctx->gpio_service = dal_gpio_service_create(
728 dc_version,
729 dc_ctx->dce_environment,
730 dc_ctx);
731
732 if (!dc_ctx->gpio_service) {
733 ASSERT_CRITICAL(false);
734 goto fail;
735 }
736
737 dc->res_pool = dc_create_resource_pool(
738 dc,
739 init_params->num_virtual_links,
740 dc_version,
741 init_params->asic_id);
742 if (!dc->res_pool)
743 goto fail;
744
745 dc_resource_state_construct(dc, dc->current_state);
746
747 if (!create_links(dc, init_params->num_virtual_links))
748 goto fail;
749
750 return true;
751
752 fail:
753
754 destruct(dc);
^^
"dc->current_state" gets dereferenced inside the function. This style
of one function cleans up everything error handling is always buggy...
:/
https://plus.google.com/u/0/106378716002406849458/posts/1Ud9JbaYnPr
755 return false;
756 }
regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next reply other threads:[~2019-01-09 19:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-09 19:29 Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-11-01 9:48 [bug report] drm/amd/dc: Add dc display driver (v2) Dan Carpenter
2017-11-06 8:20 Dan Carpenter
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=20190109192943.GA4358@kadam \
--to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=harry.wentland-5C7GfCeVMHo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.