From a1622e474a629f6e982c74e3bbf16c1c38b38bc0 Mon Sep 17 00:00:00 2001 From: Luc Verhaegen Date: Tue, 5 Apr 2011 14:41:24 +0200 Subject: [PATCH] gpu: pvr: move ioctl checking error messagess to pr_err() This way, we get to actually see ioctls failing. Also, a pointless check is removed: the switch statement that follows will take care of unhandled cases for us anyway (and now complain about them verbosely). Fixes: NB#251136 - PVR: fix IOCTL command ID range checking Signed-off-by: Luc Verhaegen Signed-off-by: Imre Deak --- pvr/bridged_pvr_bridge.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/pvr/bridged_pvr_bridge.c b/pvr/bridged_pvr_bridge.c index 4621710..980781e 100644 --- a/pvr/bridged_pvr_bridge.c +++ b/pvr/bridged_pvr_bridge.c @@ -2576,16 +2576,14 @@ static int bridged_check_cmd(u32 cmd_id) { if (PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_RAN)) { if (!PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_SUCCESSFUL)) { - PVR_DPF(PVR_DBG_ERROR, - "%s: Initialisation failed. Driver unusable.", - __func__); + pr_err("PVR: ERROR: Initialisation failed. " + "Driver unusable.\n"); return 1; } } else { if (PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_RUNNING)) { - PVR_DPF(PVR_DBG_ERROR, - "%s: Initialisation is in progress", - __func__); + pr_err("PVR: ERROR: Initialisation still in " + "progress.\n"); return 1; } else { switch (cmd_id) { @@ -2599,9 +2597,8 @@ static int bridged_check_cmd(u32 cmd_id) PVRSRV_BRIDGE_INITSRV_DISCONNECT): break; default: - PVR_DPF(PVR_DBG_ERROR, - "%s: Driver initialisation not completed yet.", - __func__); + pr_err("PVR: ERROR: initialisation not " + "completed yet.\n"); return 1; } } @@ -3008,8 +3005,7 @@ static int bridged_ioctl(struct file *filp, u32 cmd, void *in, void *out, #endif default: - PVR_DPF(PVR_DBG_ERROR, "%s: cmd = %d is out if range!", - __func__, cmd); + pr_err("PVR: Error: Unhandled IOCTL %d.\n", cmd); } pr_ioctl_error(cmd, per_proc->name, err, out, out_err_ofs); @@ -3020,7 +3016,6 @@ static int bridged_ioctl(struct file *filp, u32 cmd, void *in, void *out, int BridgedDispatchKM(struct file *filp, struct PVRSRV_PER_PROCESS_DATA *pd, struct PVRSRV_BRIDGE_PACKAGE *pkg) { - void *in; void *out; u32 bid = pkg->ui32BridgeID; @@ -3045,15 +3040,7 @@ int BridgedDispatchKM(struct file *filp, struct PVRSRV_PER_PROCESS_DATA *pd, pkg->ui32InBufferSize) != PVRSRV_OK) goto return_fault; - if (bid >= (PVRSRV_BRIDGE_LAST_SGX_CMD)) { - PVR_DPF(PVR_DBG_ERROR, - "%s: ui32BridgeID = %d is out if range!", __func__, - bid); - goto return_fault; - } - err = bridged_ioctl(filp, bid, in, out, pkg->ui32InBufferSize, pd); - if (err < 0) goto return_fault; -- 2.39.2