From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
kbuild@01.org, kbuild-all@01.org, nouveau@lists.freedesktop.org,
Ben Skeggs <bskeggs@redhat.com>
Subject: Re: [PATCH v2 5/9] drm/nouveau: Use drm_connector_for_each_possible_encoder()
Date: Mon, 2 Jul 2018 16:04:45 +0300 [thread overview]
Message-ID: <20180702130445.GI5565@intel.com> (raw)
In-Reply-To: <20180630191221.a6o6gr7wdbjckkwm@mwanda>
On Sat, Jun 30, 2018 at 10:12:21PM +0300, Dan Carpenter wrote:
> Hi Ville,
>
> Thank you for the patch! Perhaps something to improve:
>
> url: https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-Third-attempt-at-fixing-the-fb-helper-best_encoder-mess/20180629-014202
> base: git://people.freedesktop.org/~airlied/linux.git drm-next
>
> smatch warnings:
> drivers/gpu/drm/nouveau/nouveau_connector.c:461 nouveau_connector_ddc_detect() error: uninitialized symbol 'nv_encoder'.
>
> # https://github.com/0day-ci/linux/commit/7ec8bb65386edfb0b2bdc8e8391eb5e6eac44c06
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout 7ec8bb65386edfb0b2bdc8e8391eb5e6eac44c06
> vim +/nv_encoder +461 drivers/gpu/drm/nouveau/nouveau_connector.c
>
> 6ee738610 Ben Skeggs 2009-12-11 407
> 8777c5c11 Ben Skeggs 2014-06-06 408 static struct nouveau_encoder *
> 8777c5c11 Ben Skeggs 2014-06-06 409 nouveau_connector_ddc_detect(struct drm_connector *connector)
> 6ee738610 Ben Skeggs 2009-12-11 410 {
> 6ee738610 Ben Skeggs 2009-12-11 411 struct drm_device *dev = connector->dev;
> 1a1841d30 Ben Skeggs 2012-12-10 412 struct nouveau_connector *nv_connector = nouveau_connector(connector);
> 77145f1cb Ben Skeggs 2012-07-31 413 struct nouveau_drm *drm = nouveau_drm(dev);
> 1167c6bc5 Ben Skeggs 2016-05-18 414 struct nvkm_gpio *gpio = nvxx_gpio(&drm->client.device);
> 8777c5c11 Ben Skeggs 2014-06-06 415 struct nouveau_encoder *nv_encoder;
> 6d385c0aa Rob Clark 2014-07-17 416 struct drm_encoder *encoder;
> 1a1841d30 Ben Skeggs 2012-12-10 417 int i, panel = -ENODEV;
> 1a1841d30 Ben Skeggs 2012-12-10 418
> 1a1841d30 Ben Skeggs 2012-12-10 419 /* eDP panels need powering on by us (if the VBIOS doesn't default it
> 1a1841d30 Ben Skeggs 2012-12-10 420 * to on) before doing any AUX channel transactions. LVDS panel power
> 1a1841d30 Ben Skeggs 2012-12-10 421 * is handled by the SOR itself, and not required for LVDS DDC.
> 1a1841d30 Ben Skeggs 2012-12-10 422 */
> 1a1841d30 Ben Skeggs 2012-12-10 423 if (nv_connector->type == DCB_CONNECTOR_eDP) {
> 2ea7249fe Ben Skeggs 2015-08-20 424 panel = nvkm_gpio_get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff);
> 1a1841d30 Ben Skeggs 2012-12-10 425 if (panel == 0) {
> 2ea7249fe Ben Skeggs 2015-08-20 426 nvkm_gpio_set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1);
> 1a1841d30 Ben Skeggs 2012-12-10 427 msleep(300);
> 1a1841d30 Ben Skeggs 2012-12-10 428 }
> 1a1841d30 Ben Skeggs 2012-12-10 429 }
> 6ee738610 Ben Skeggs 2009-12-11 430
> 7ec8bb653 Ville Syrjälä 2018-06-28 431 drm_connector_for_each_possible_encoder(connector, encoder, i) {
> 6d385c0aa Rob Clark 2014-07-17 432 nv_encoder = nouveau_encoder(encoder);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> If we enter the loop that means nv_encoder is non-NULL. Smatch can't
> prove that we always enter the loop in this case for whatever reason but
> my guess is that we always do.
>
> 4ca2b7120 Francisco Jerez 2010-08-08 433
> 8777c5c11 Ben Skeggs 2014-06-06 434 if (nv_encoder->dcb->type == DCB_OUTPUT_DP) {
> 8777c5c11 Ben Skeggs 2014-06-06 435 int ret = nouveau_dp_detect(nv_encoder);
> 52aa30f25 Ben Skeggs 2016-11-04 436 if (ret == NOUVEAU_DP_MST)
> 52aa30f25 Ben Skeggs 2016-11-04 437 return NULL;
> 52aa30f25 Ben Skeggs 2016-11-04 438 if (ret == NOUVEAU_DP_SST)
> 8777c5c11 Ben Skeggs 2014-06-06 439 break;
> 8777c5c11 Ben Skeggs 2014-06-06 440 } else
> 39c1c9011 Lukas Wunner 2016-01-11 441 if ((vga_switcheroo_handler_flags() &
> 39c1c9011 Lukas Wunner 2016-01-11 442 VGA_SWITCHEROO_CAN_SWITCH_DDC) &&
> 39c1c9011 Lukas Wunner 2016-01-11 443 nv_encoder->dcb->type == DCB_OUTPUT_LVDS &&
> 39c1c9011 Lukas Wunner 2016-01-11 444 nv_encoder->i2c) {
> 39c1c9011 Lukas Wunner 2016-01-11 445 int ret;
> 39c1c9011 Lukas Wunner 2016-01-11 446 vga_switcheroo_lock_ddc(dev->pdev);
> 39c1c9011 Lukas Wunner 2016-01-11 447 ret = nvkm_probe_i2c(nv_encoder->i2c, 0x50);
> 39c1c9011 Lukas Wunner 2016-01-11 448 vga_switcheroo_unlock_ddc(dev->pdev);
> 39c1c9011 Lukas Wunner 2016-01-11 449 if (ret)
> 39c1c9011 Lukas Wunner 2016-01-11 450 break;
> 39c1c9011 Lukas Wunner 2016-01-11 451 } else
> 8777c5c11 Ben Skeggs 2014-06-06 452 if (nv_encoder->i2c) {
> 2aa5eac51 Ben Skeggs 2015-08-20 453 if (nvkm_probe_i2c(nv_encoder->i2c, 0x50))
> 1a1841d30 Ben Skeggs 2012-12-10 454 break;
> 6ee738610 Ben Skeggs 2009-12-11 455 }
> 6ee738610 Ben Skeggs 2009-12-11 456 }
> 6ee738610 Ben Skeggs 2009-12-11 457
> 1a1841d30 Ben Skeggs 2012-12-10 458 /* eDP panel not detected, restore panel power GPIO to previous
> 1a1841d30 Ben Skeggs 2012-12-10 459 * state to avoid confusing the SOR for other output types.
> 1a1841d30 Ben Skeggs 2012-12-10 460 */
> 8777c5c11 Ben Skeggs 2014-06-06 @461 if (!nv_encoder && panel == 0)
> ^^^^^^^^^^^
> So testing for NULL doesn't make sense. It's either non-NULL if we
> entered the loop at least once or it's uninitialized if we didn't enter
> the loop.
Yeah, seems like a bogus check. I suppose in theory you could have a
connector with no encoders, although I can't think of any good reason
why anyone would do that.
>
> 2ea7249fe Ben Skeggs 2015-08-20 462 nvkm_gpio_set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, panel);
> 1a1841d30 Ben Skeggs 2012-12-10 463
> 8777c5c11 Ben Skeggs 2014-06-06 464 return nv_encoder;
> 6ee738610 Ben Skeggs 2009-12-11 465 }
> 6ee738610 Ben Skeggs 2009-12-11 466
>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-07-02 13:04 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-28 13:13 [PATCH v2 0/9] drm: Third attempt at fixing the fb-helper .best_encoder() mess Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 1/9] drm/fb-helper: Eliminate the .best_encoder() usage Ville Syrjala
2018-06-28 15:27 ` Alex Deucher
2018-07-05 13:59 ` Ville Syrjälä
2018-06-28 13:13 ` [PATCH v2 2/9] drm/i915: Nuke intel_mst_best_encoder() Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 3/9] drm: Add drm_connector_for_each_possible_encoder() Ville Syrjala
2018-06-28 16:56 ` Daniel Vetter
2018-06-28 17:24 ` Ville Syrjälä
2018-06-28 13:13 ` [PATCH v2 4/9] drm/amdgpu: Use drm_connector_for_each_possible_encoder() Ville Syrjala
[not found] ` <20180628131315.14156-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-28 13:13 ` [PATCH v2 5/9] drm/nouveau: " Ville Syrjala
2018-06-30 19:12 ` Dan Carpenter
2018-07-02 13:04 ` Ville Syrjälä [this message]
2018-07-02 14:05 ` Ville Syrjälä
[not found] ` <20180628131315.14156-6-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-02 15:29 ` [PATCH v3 " Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 6/9] drm/radeon: " Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 8/9] drm/msm: Use drm_connector_has_possible_encoder() Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 7/9] drm: Add drm_connector_has_possible_encoder() Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 9/9] drm/tilcdc: Use drm_connector_has_possible_encoder() Ville Syrjala
2018-06-28 13:45 ` Jyri Sarha
2018-06-28 17:52 ` Ville Syrjälä
2018-06-28 13:32 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Third attempt at fixing the fb-helper .best_encoder() mess Patchwork
2018-06-28 13:47 ` [PATCH v2 0/9] " Ville Syrjälä
2018-06-28 13:50 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-06-28 15:35 ` ✓ Fi.CI.IGT: " Patchwork
2018-07-02 15:47 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Third attempt at fixing the fb-helper .best_encoder() mess (rev2) Patchwork
2018-07-02 16:06 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-02 18:28 ` ✓ Fi.CI.IGT: " Patchwork
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=20180702130445.GI5565@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=bskeggs@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=kbuild-all@01.org \
--cc=kbuild@01.org \
--cc=nouveau@lists.freedesktop.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;
as well as URLs for NNTP newsgroup(s).