Don't try to use dev->dma_lock unless dma is initialized (dev->dma != NULL)
in bufs_info sysctl handler. dev->dma and dev->dma_lock existence are protected by DRM_LOCK(). Fixes panic on sysctl hw.dri when the device is uninitialied (when you aren't in X).main
parent
e4a2a9c040
commit
2423fedcc8
|
@ -224,12 +224,11 @@ static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS
|
||||||
* copy of the whole structure and the relevant data from buflist.
|
* copy of the whole structure and the relevant data from buflist.
|
||||||
*/
|
*/
|
||||||
DRM_LOCK();
|
DRM_LOCK();
|
||||||
DRM_SPINLOCK(&dev->dma_lock);
|
|
||||||
if (dma == NULL) {
|
if (dma == NULL) {
|
||||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
|
||||||
DRM_UNLOCK();
|
DRM_UNLOCK();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
DRM_SPINLOCK(&dev->dma_lock);
|
||||||
tempdma = *dma;
|
tempdma = *dma;
|
||||||
templists = DRM(alloc)(sizeof(int) * dma->buf_count, DRM_MEM_BUFS);
|
templists = DRM(alloc)(sizeof(int) * dma->buf_count, DRM_MEM_BUFS);
|
||||||
for (i = 0; i < dma->buf_count; i++)
|
for (i = 0; i < dma->buf_count; i++)
|
||||||
|
|
|
@ -224,12 +224,11 @@ static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS
|
||||||
* copy of the whole structure and the relevant data from buflist.
|
* copy of the whole structure and the relevant data from buflist.
|
||||||
*/
|
*/
|
||||||
DRM_LOCK();
|
DRM_LOCK();
|
||||||
DRM_SPINLOCK(&dev->dma_lock);
|
|
||||||
if (dma == NULL) {
|
if (dma == NULL) {
|
||||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
|
||||||
DRM_UNLOCK();
|
DRM_UNLOCK();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
DRM_SPINLOCK(&dev->dma_lock);
|
||||||
tempdma = *dma;
|
tempdma = *dma;
|
||||||
templists = DRM(alloc)(sizeof(int) * dma->buf_count, DRM_MEM_BUFS);
|
templists = DRM(alloc)(sizeof(int) * dma->buf_count, DRM_MEM_BUFS);
|
||||||
for (i = 0; i < dma->buf_count; i++)
|
for (i = 0; i < dma->buf_count; i++)
|
||||||
|
|
Loading…
Reference in New Issue