From mboxrd@z Thu Jan 1 00:00:00 1970 From: Francisco Jerez Subject: Re: [PATCH] drm/nouveau: fix oops on unload with disabled LVDS panel Date: Sun, 20 Mar 2011 18:45:40 +0100 Message-ID: <87d3lllm7v.fsf@riseup.net> References: <20110310214325.GA18211@joi.lan> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1135132056==" Return-path: In-Reply-To: <20110310214325.GA18211-OI9uyE9O0yo@public.gmane.org> (Marcin Slusarz's message of "Thu, 10 Mar 2011 22:43:25 +0100") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: Marcin Slusarz Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Ben Skeggs List-Id: nouveau.vger.kernel.org --===============1135132056== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Marcin Slusarz writes: > Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=3D35135 > BUG: unable to handle kernel NULL pointer dereference at 000002d8 > IP: [] nv04_dfp_restore+0x7f/0xd0 [nouveau] > (...) > Call Trace: > [] nv04_display_destroy+0xa8/0x140 [nouveau] > [] nouveau_unload+0x2a/0x160 [nouveau] > [] drm_put_dev+0xbb/0x1b0 [drm] > [] nouveau_pci_remove+0x15/0x20 [nouveau] > [] pci_device_remove+0x44/0xf0 > [] __device_release_driver+0x51/0xb0 > [] driver_detach+0x8f/0xa0 > [] bus_remove_driver+0x63/0xa0 > [] driver_unregister+0x49/0x80 > [] ? sysfs_remove_file+0x14/0x20 > [] pci_unregister_driver+0x32/0x90 > [] ? __stop_machine+0x5a/0x70 > [] drm_exit+0x83/0x90 [drm] > [] nouveau_exit+0x1b/0x8be [nouveau] > [] sys_delete_module+0x13b/0x1f0 > [] ? do_munmap+0x1fe/0x280 > [] ? arch_unmap_area_topdown+0x0/0x20 > [] syscall_call+0x7/0xb > > Reported-by: Francesco Marella > Tested-by: Francesco Marella > Signed-off-by: Marcin Slusarz > --- > drivers/gpu/drm/nouveau/nv04_dfp.c | 20 +++++++++++++++----- > 1 files changed, 15 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau= /nv04_dfp.c > index c82db37..b985ab3 100644 > --- a/drivers/gpu/drm/nouveau/nv04_dfp.c > +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c > @@ -579,15 +579,24 @@ static void nv04_dfp_restore(struct drm_encoder *en= coder) > struct drm_device *dev =3D encoder->dev; > struct drm_nouveau_private *dev_priv =3D dev->dev_private; > int head =3D nv_encoder->restore.head; > + struct nouveau_connector *connector; > + struct drm_display_mode *native_mode; >=20=20 > if (nv_encoder->dcb->type =3D=3D OUTPUT_LVDS) { > - struct drm_display_mode *native_mode =3D nouveau_encoder_connector_get= (nv_encoder)->native_mode; > - if (native_mode) > - call_lvds_script(dev, nv_encoder->dcb, head, LVDS_PANEL_ON, > - native_mode->clock); > - else > + connector =3D nouveau_encoder_connector_get(nv_encoder); > + if (!connector) { > + NV_ERROR(dev, "No connector for LVDS encoder. Skipping restore.\n"); > + goto out; > + } > + > + native_mode =3D connector->native_mode; > + if (!native_mode) { > NV_ERROR(dev, "Not restoring LVDS without native mode\n"); > + goto out; > + } >=20=20 > + call_lvds_script(dev, nv_encoder->dcb, head, LVDS_PANEL_ON, > + native_mode->clock); > } else if (nv_encoder->dcb->type =3D=3D OUTPUT_TMDS) { > int clock =3D nouveau_hw_pllvals_to_clk > (&dev_priv->saved_reg.crtc_reg[head].pllvals); > @@ -595,6 +604,7 @@ static void nv04_dfp_restore(struct drm_encoder *enco= der) > run_tmds_table(dev, nv_encoder->dcb, head, clock); > } >=20=20 > +out: > nv_encoder->last_dpms =3D NV_DPMS_CLEARED; > } Thanks, I've pushed a slightly simplified version of this patch. --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EAREIAAYFAk2GPUQACgkQg5k4nX1Sv1tupwEAl7R/RaBGiDpNjqy0buv2o8tw Et+Ffzj3Ijc3WJ24nEkA/2IpcUA3JXPCaM5YbOHzFYfIWw+C34v0A1wg0qKIndVX =GC/l -----END PGP SIGNATURE----- --==-=-=-- --===============1135132056== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Nouveau mailing list Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org http://lists.freedesktop.org/mailman/listinfo/nouveau --===============1135132056==--