Skip to contentSkip to conversation

drm/i915: fix wrong error number report

PATCH In review Andi Shyti 3 participants 5 messages Oct 2, 2018

Subsystems (2)
lore
Share & tools
lore

Andi Shyti

author
#0 lore raw

PATCH v2 1/1 drm/i915: fix wrong error number report

During driver load it's considered that the i915_driver_create() function fails only in case of insufficient memory. Indeed, in case of failure of i915_driver_create(), the load function returns indiscriminately -ENOMEM ignoring the real cause of failure.

In i915_driver_create() get the consistent error value from drm_dev_init() and embed it in the pointer return value.

---
Hi,

I did forget in the version 1 to return -ENOMEM in case of kzalloc failure. Thanks Chris!

Andi

 drivers/gpu/drm/i915/i915_drv.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +7 -5
index 1b028f429e92..193023427b40 100644
@@ -1627,14 +1627,16 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent)
 		(struct intel_device_info *)ent->driver_data;
 	struct intel_device_info *device_info;
 	struct drm_i915_private *i915;
+	int err;
 
 	i915 = kzalloc(sizeof(*i915), GFP_KERNEL);
 	if (!i915)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
-	if (drm_dev_init(&i915->drm, &driver, &pdev->dev)) {
+	err = drm_dev_init(&i915->drm, &driver, &pdev->dev);
+	if (err) {
 		kfree(i915);
-		return NULL;
+		return ERR_PTR(err);
 	}
 
 	i915->drm.pdev = pdev;
@@ -1683,8 +1685,8 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
 	int ret;
 
 	dev_priv = i915_driver_create(pdev, ent);
-	if (!dev_priv)
-		return -ENOMEM;
+	if (IS_ERR(dev_priv))
+		return PTR_ERR(dev_priv);
 
 	/* Disable nuclear pageflip by default on pre-ILK */
 	if (!i915_modparams.nuclear_pageflip && match_info->gen < 5)
Signature · 6 lines
2.19.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915: fix wrong error number report (rev2)

== Series Details ==

== Series Details ==

Series: drm/i915: fix wrong error number report (rev2)
URL : https://patchwork.freedesktop.org/series/50406/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4913 -> Patchwork_10321 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/50406/revisions/2/mbox/

== Known issues ==

Here are the changes found in Patchwork_10321 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-blb-e6850:       NOTRUN -> INCOMPLETE (fdo#107718)

    igt@kms_frontbuffer_tracking@basic:
      fi-byt-clapper:     PASS -> FAIL (fdo#103167)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362) +1

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       INCOMPLETE (fdo#107718) -> PASS

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718

== Participating hosts (46 -> 43) ==

Missing (3): fi-bsw-cyan fi-byt-squawks fi-icl-u2

== Build changes ==

* Linux: CI_DRM_4913 -> Patchwork_10321

CI_DRM_4913: 8841faa15ae85eff15d285c64353d2b75d7b400f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4660: d0975646c50568e66e65b44b81d28232d059b94e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10321: fc708873d177e20e345d0a37b5f6cc6912f7ab21 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

fc708873d177 drm/i915: fix wrong error number report

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10321/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v2 1/1
#2 lore raw
In reply to Andi Shyti

Quoting Andi Shyti (2018-10-02 10:20:47)

Quoted 5 lines

During driver load it's considered that the i915_driver_create() function fails only in case of insufficient memory. Indeed, in case of failure of i915_driver_create(), the load function returns indiscriminately -ENOMEM ignoring the real cause of failure.

Though if it is not ENOMEM, some stern words will be addressed to whomever at fault.

Quoted 4 lines

In i915_driver_create() get the consistent error value from drm_dev_init() and embed it in the pointer return value.

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Quoting Chris Wilson (2018-10-02 12:18:49)

Quoted 7 lines

Quoting Andi Shyti (2018-10-02 10:20:47)

Quoted 5 lines

During driver load it's considered that the i915_driver_create() function fails only in case of insufficient memory. Indeed, in case of failure of i915_driver_create(), the load function returns indiscriminately -ENOMEM ignoring the real cause of failure.

Quoted 8 lines

Though if it is not ENOMEM, some stern words will be addressed to whomever at fault.

Quoted 4 lines

In i915_driver_create() get the consistent error value from drm_dev_init() and embed it in the pointer return value.

And pushed, thanks for the patch.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.IGT: success for drm/i915: fix wrong error number report (rev2)

In reply to Andi Shyti
== Series Details ==

== Series Details ==

Series: drm/i915: fix wrong error number report (rev2)
URL : https://patchwork.freedesktop.org/series/50406/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4913_full -> Patchwork_10321_full =

== Summary - SUCCESS ==

No regressions found.

== Known issues ==

Here are the changes found in Patchwork_10321_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@forcewake:
      shard-skl:          PASS -> INCOMPLETE (fdo#107773, fdo#104108)

    igt@drv_suspend@shrink:
      shard-glk:          PASS -> INCOMPLETE (k.org#198133, fdo#106886, fdo#103359)

    igt@gem_exec_await@wide-contexts:
      shard-kbl:          PASS -> FAIL (fdo#106680)

    igt@gem_exec_schedule@pi-ringfull-vebox:
      shard-skl:          NOTRUN -> FAIL (fdo#103158)

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-skl:          NOTRUN -> TIMEOUT (fdo#108130, fdo#108039)

    igt@gem_userptr_blits@readonly-unsync:
      shard-skl:          PASS -> INCOMPLETE (fdo#108074)

    igt@kms_busy@extended-modeset-hang-newfb-render-a:
      shard-snb:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_cursor_crc@cursor-256x256-offscreen:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@kms_flip@dpms-vs-vblank-race-interruptible:
      shard-apl:          PASS -> FAIL (fdo#103060)

    igt@kms_flip@flip-vs-expired-vblank:
      shard-skl:          PASS -> FAIL (fdo#105363)

    igt@kms_frontbuffer_tracking@psr-suspend:
      shard-skl:          PASS -> INCOMPLETE (fdo#107773, fdo#106978, fdo#104108)

    igt@kms_panel_fitting@legacy:
      shard-skl:          NOTRUN -> FAIL (fdo#105456)

    igt@kms_plane@pixel-format-pipe-b-planes:
      shard-skl:          NOTRUN -> DMESG-WARN (fdo#106885)

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          NOTRUN -> FAIL (fdo#103166)

    igt@kms_setmode@basic:
      shard-hsw:          PASS -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@gem_ctx_isolation@bcs0-s3:
      shard-kbl:          INCOMPLETE (fdo#103665) -> PASS

    igt@gem_exec_await@wide-contexts:
      shard-skl:          FAIL (fdo#100007) -> PASS

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          INCOMPLETE (fdo#103665, fdo#106023) -> PASS

    igt@kms_cursor_legacy@cursorb-vs-flipb-toggle:
      shard-glk:          DMESG-WARN (fdo#105763, fdo#106538) -> PASS +1

    igt@pm_rpm@dpms-lpsp:
      shard-skl:          INCOMPLETE (fdo#107807) -> PASS

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105456 https://bugs.freedesktop.org/show_bug.cgi?id=105456
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#106680 https://bugs.freedesktop.org/show_bug.cgi?id=106680
fdo#106885 https://bugs.freedesktop.org/show_bug.cgi?id=106885
fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
fdo#106978 https://bugs.freedesktop.org/show_bug.cgi?id=106978
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108039 https://bugs.freedesktop.org/show_bug.cgi?id=108039
fdo#108074 https://bugs.freedesktop.org/show_bug.cgi?id=108074
fdo#108130 https://bugs.freedesktop.org/show_bug.cgi?id=108130
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (6 -> 6) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4913 -> Patchwork_10321

CI_DRM_4913: 8841faa15ae85eff15d285c64353d2b75d7b400f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4660: d0975646c50568e66e65b44b81d28232d059b94e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10321: fc708873d177e20e345d0a37b5f6cc6912f7ab21 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10321/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx