<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - src/intel_device.c reverses return value meaning of xorg server xf86LoadKernelModule()"
href="https://bugs.freedesktop.org/show_bug.cgi?id=100011">100011</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>src/intel_device.c reverses return value meaning of xorg server xf86LoadKernelModule()
</td>
</tr>
<tr>
<th>Product</th>
<td>xorg
</td>
</tr>
<tr>
<th>Version</th>
<td>git
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>FreeBSD
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver/intel
</td>
</tr>
<tr>
<th>Assignee</th>
<td>chris@chris-wilson.co.uk
</td>
</tr>
<tr>
<th>Reporter</th>
<td>davshao@gmail.com
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>intel-gfx-bugs@lists.freedesktop.org
</td>
</tr></table>
<p>
<div>
<pre>The function load_i915_kernel_module() in file src/intel_device.c
of xf86-video-intel reverses the meaning of the return value of
xorg server's xf86LoadKernelModule(). xf86LoadKernelModule()
actually returns 0 if the loading fails, non-zero if success.
For example, from xorg server 1.19.1's source code,
file hw/xfree86/os-support/linux/lnx_kmod.c:
* Input:
* modName - name of the kernel module (Ex: "tdfx")
* Return:
* 0 for failure, 1 for success
*/
int
xf86LoadKernelModule(const char *modName)
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
return 1; /* success! */
}
else {
return 0;
}
And from file hw/xfree86/os-support/bsd/bsd_kmod.c
* Return:
* 0 for failure, 1 for success
*/
int
xf86LoadKernelModule(const char *modName)
{
if (kldload(modName) != -1)
return 1;
else
return 0;
}
On FreeBSD there is an additional complication that if
"i915kms" is added to kernel_module_names, the inverted use
of the return value causes both i915kms.ko and i915.ko to
be loaded.
Therefore I believe a patch similar to the following needs to be made
to src/intel_device.c:
@@ -233,9 +242,8 @@ static int load_i915_kernel_module(void)
const char **kn;
for (kn = kernel_module_names; *kn; kn++)
- if (xf86LoadKernelModule(*kn) == 0)
+ if (xf86LoadKernelModule(*kn))
return 0;
-
return -1;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>