gpu: nvgpu: fix the return type for power node read/write fops

When error (negative value) with int type is returned from read/write
fops (gk20a_power_node_ops) is read as ssize_t value as expected in
userspace it will be seen as large non-negative number and will
suppress the error.

Make return type for these fops ssize_t.

Also include power_ops.h in power_ops.c. This would have caught the
type mismatch issue.

Bug 3388725

Change-Id: Ie66b0178b31a1b7d147b4f441884bbba3bd2e4d8
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2604342
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2021-10-02 13:09:39 +05:30
committed by mobile promotions
parent 4333bc7faf
commit 396c77d7f8

View File

@@ -32,6 +32,8 @@
#include "ioctl.h"
#include "power_ops.h"
#include "platform_gk20a.h"
#include "os_linux.h"
#include "module.h"
@@ -56,7 +58,7 @@ int gk20a_power_open(struct inode *inode, struct file *filp)
return 0;
}
int gk20a_power_read(struct file *filp, char __user *buf,
ssize_t gk20a_power_read(struct file *filp, char __user *buf,
size_t size, loff_t *off)
{
struct gk20a *g = filp->private_data;
@@ -90,8 +92,7 @@ int gk20a_power_read(struct file *filp, char __user *buf,
return size;
}
int gk20a_power_write(struct file *filp, const char __user *buf,
ssize_t gk20a_power_write(struct file *filp, const char __user *buf,
size_t size, loff_t *off)
{
struct gk20a *g = filp->private_data;