]> asedeno.scripts.mit.edu Git - linux.git/commit
drm/i915/gvt: verify functions types in new_mmio_info()
authorNicolas Iooss <nicolas.iooss_linux@m4x.org>
Mon, 26 Dec 2016 13:52:23 +0000 (14:52 +0100)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Mon, 9 Jan 2017 03:05:55 +0000 (11:05 +0800)
commit3e70c5d6ea510e38f612d07fa0fd7487277b7087
treec0854aeb33b225b2554f4054d576893b605da45d
parenta121103c922847ba5010819a3f250f1f7fc84ab8
drm/i915/gvt: verify functions types in new_mmio_info()

The current prototype of new_mmio_info() uses void* for parameters read
and write, which are functions with precise calling conventions
(argument types and return type). Write down these conventions in
new_mmio_info() definition.

This has been reported by the following warnings when clang is used to
build the kernel:

    drivers/gpu/drm/i915/gvt/handlers.c:124:21: error: pointer type
    mismatch ('void *' and 'int (*)(struct intel_vgpu *, unsigned int,
    void *, unsigned int)') [-Werror,-Wpointer-type-mismatch]
            info->read = read ? read : intel_vgpu_default_mmio_read;
                              ^ ~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/gpu/drm/i915/gvt/handlers.c:125:23: error: pointer type
    mismatch ('void *' and 'int (*)(struct intel_vgpu *, unsigned int,
    void *, unsigned int)') [-Werror,-Wpointer-type-mismatch]
            info->write = write ? write : intel_vgpu_default_mmio_write;
                                ^ ~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This allows the compiler to detect that sbi_ctl_mmio_write() returns a
"bool" value instead of an expected "int" one. Fix this.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/handlers.c