mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
drivers: nv-virtio-poc: fix coverity issues
Fix issues about unused value of err and overwriting write_size value. write_size: assigned_value: Assigning value from err to write_size here, but that stored value is overwritten before it can be used. ... value_overwrite: Overwriting previous write to write_size with value from copied. err: returned_value: Assigning value from nvvc_process_rxdataavaiable() to err here, but that stored value is overwritten before it can be used. CID 10174057 CID 10174058 Bug 3952896 Change-Id: I21ef42b7c1c3fec83e558f80d954b65dbb14a5b8 Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2969244 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
fa20ae0dd6
commit
0f04078fb6
@@ -181,10 +181,11 @@ static ssize_t nvvc_write(struct file *f, const char *buf, size_t buf_size, loff
|
|||||||
err = kfifo_from_user(&nvvcdev->nvvc_rx_fifo, buf, buf_size, &copied);
|
err = kfifo_from_user(&nvvcdev->nvvc_rx_fifo, buf, buf_size, &copied);
|
||||||
if (err) {
|
if (err) {
|
||||||
write_size = err;
|
write_size = err;
|
||||||
} else if (copied != buf_size) {
|
} else {
|
||||||
pr_debug("nvvc: partial write done (%u)\n", copied);
|
write_size = copied;
|
||||||
|
pr_debug("nvvc: wrote %u bytes out of %ld bytes\n",
|
||||||
|
copied, buf_size);
|
||||||
}
|
}
|
||||||
write_size = copied;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (kfifo_is_full(&nvvcdev->nvvc_tx_fifo)) {
|
if (kfifo_is_full(&nvvcdev->nvvc_tx_fifo)) {
|
||||||
@@ -201,11 +202,11 @@ static ssize_t nvvc_write(struct file *f, const char *buf, size_t buf_size, loff
|
|||||||
err = kfifo_from_user(&nvvcdev->nvvc_tx_fifo, buf, buf_size, &copied);
|
err = kfifo_from_user(&nvvcdev->nvvc_tx_fifo, buf, buf_size, &copied);
|
||||||
if (err) {
|
if (err) {
|
||||||
write_size = err;
|
write_size = err;
|
||||||
} else if (copied != buf_size) {
|
} else {
|
||||||
pr_debug("nvvc: partial write done (%u)\n", copied);
|
write_size = copied;
|
||||||
|
pr_debug("nvvc: wrote %u bytes out of %ld bytes\n",
|
||||||
|
copied, buf_size);
|
||||||
}
|
}
|
||||||
write_size = copied;
|
|
||||||
pr_debug("Write nvvc: wrote %d bytes\n", write_size);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,7 +587,7 @@ static void nvvc_work(struct work_struct *work)
|
|||||||
{
|
{
|
||||||
struct nvvc_dev *nvvcdev = container_of(work, struct nvvc_dev, work);
|
struct nvvc_dev *nvvcdev = container_of(work, struct nvvc_dev, work);
|
||||||
uint32_t ivc_cmd, ivc_resp;
|
uint32_t ivc_cmd, ivc_resp;
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
if (tegra_hv_ivc_channel_notified(nvvcdev->ivc) != 0) {
|
if (tegra_hv_ivc_channel_notified(nvvcdev->ivc) != 0) {
|
||||||
pr_err("nvvc_work: ivc channel not notified\n");
|
pr_err("nvvc_work: ivc channel not notified\n");
|
||||||
@@ -625,6 +626,8 @@ static void nvvc_work(struct work_struct *work)
|
|||||||
nvvc_received_rxdataavaiable = true;
|
nvvc_received_rxdataavaiable = true;
|
||||||
|
|
||||||
err = nvvc_process_rxdataavaiable();
|
err = nvvc_process_rxdataavaiable();
|
||||||
|
if (err < 0)
|
||||||
|
pr_debug("nvvc_process_rxdataavaiable failed: err %d\n", err);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr_err("ivc read invalid command: 0x%x\n", ivc_cmd);
|
pr_err("ivc read invalid command: 0x%x\n", ivc_cmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user