mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
camera:kmd replace WARN/WARN_ON usage
Replace use of WARN or WARN_ON kernel with dev_warn to improve logging behavior. This change ensures that error conditions are reported with clear informative messages rather than kernel stack traces that can flood logs. Additional information: - The files `drivers/platform/tegra/rtcpu/debug.c` and `drivers/platform/tegra/rtcpu/hsp-combo.c` present in the original codebase were deleted as part of unrelated refactoring in the target repository; hence, changes related to these files in the patch were not applied. - Additional changes are done to replace WARN_ON at other places. Bug 4719119 Change-Id: Id12f1b4de77f8b007b557de140257a3bd7478b52 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/3308911 Signed-off-by: Mohit Ingale <mohiti@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3352892 Reviewed-by: Jagadeesh Kinni <jkinni@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Vincent Chung <vincentc@nvidia.com> Reviewed-by: Frank Chen <frankc@nvidia.com>
This commit is contained in:
@@ -298,7 +298,7 @@ init_err:
|
||||
* It performs the following operations:
|
||||
* - Calls @ref isp_capture_shutdown() to shut down the ISP capture process.
|
||||
* - Acquires the channel driver's lock by invoking @ref mutex_lock().
|
||||
* - Verifies that the channel being released matches the registered channel using @ref WARN_ON().
|
||||
* - Verifies that the channel being released matches the registered channel.
|
||||
* - Removes the channel from the driver's channel array by setting the corresponding entry to NULL.
|
||||
* - Releases the channel driver's lock by calling @ref mutex_unlock().
|
||||
* - Frees the memory allocated for the channel using @ref kfree().
|
||||
@@ -322,7 +322,9 @@ static int isp_channel_release(
|
||||
|
||||
mutex_lock(&chan_drv->lock);
|
||||
|
||||
WARN_ON(chan_drv->channels[channel] != chan);
|
||||
if (chan_drv->channels[channel] != chan)
|
||||
dev_warn(chan_drv->dev, "%s: dev does not match!\n", __func__);
|
||||
|
||||
chan_drv->channels[channel] = NULL;
|
||||
|
||||
mutex_unlock(&chan_drv->lock);
|
||||
@@ -611,7 +613,7 @@ static int isp_channel_major = -1;
|
||||
* device TO @a ndev and the maximum number of channels to @a max_isp_channels.
|
||||
* - Initializes the driver mutex lock using @ref mutex_init().
|
||||
* - Acquires the global channel driver lock by invoking @ref mutex_lock().
|
||||
* - Checks if a channel driver is already registered using @ref WARN_ON().
|
||||
* - Checks if a channel driver is already registered.
|
||||
* If a driver is already registered, it releases the lock and frees the allocated
|
||||
* memory with @ref kfree().
|
||||
* - Sets the global channel driver reference to the newly allocated driver and
|
||||
@@ -629,8 +631,7 @@ static int isp_channel_major = -1;
|
||||
* @retval 0 Successfully registered and initialized the ISP channel driver.
|
||||
* @retval -ENOMEM If memory allocation for the driver structure fails,
|
||||
* as indicated by @ref kzalloc().
|
||||
* @retval -EBUSY If an ISP channel driver is already registered, detected via
|
||||
* @ref WARN_ON().
|
||||
* @retval -EBUSY If an ISP channel driver is already registered.
|
||||
* @retval -EINVAL If the ISP channel major number is invalid, as checked before
|
||||
* device creation.
|
||||
*/
|
||||
@@ -653,7 +654,8 @@ int isp_channel_drv_register(
|
||||
mutex_init(&chan_drv->lock);
|
||||
|
||||
mutex_lock(&chdrv_lock);
|
||||
if (WARN_ON(chdrv_ != NULL)) {
|
||||
if (chdrv_ != NULL) {
|
||||
dev_warn(chan_drv->dev, "%s: dev is busy\n", __func__);
|
||||
mutex_unlock(&chdrv_lock);
|
||||
kfree(chan_drv);
|
||||
return -EBUSY;
|
||||
@@ -731,7 +733,7 @@ EXPORT_SYMBOL(isp_channel_drv_fops_register);
|
||||
* - Acquires the global channel driver lock using @ref mutex_lock().
|
||||
* - Retrieves the current ISP channel driver instance from the global reference.
|
||||
* - Clears the global channel driver reference to indicate that it is no longer registered.
|
||||
* - Validates that the provided device matches the driver's device using @ref WARN_ON().
|
||||
* - Validates that the provided device matches the driver's device.
|
||||
* - Releases the global channel driver lock using @ref mutex_unlock().
|
||||
* - Checks if the ISP channel major number is valid. If invalid, logs an error using
|
||||
* @ref pr_err() and exits.
|
||||
@@ -751,7 +753,10 @@ void isp_channel_drv_unregister(
|
||||
mutex_lock(&chdrv_lock);
|
||||
chan_drv = chdrv_;
|
||||
chdrv_ = NULL;
|
||||
WARN_ON(chan_drv->dev != dev);
|
||||
|
||||
if (chan_drv->dev != dev)
|
||||
dev_warn(chan_drv->dev, "%s: dev does not match\n", __func__);
|
||||
|
||||
mutex_unlock(&chdrv_lock);
|
||||
|
||||
if (isp_channel_major < 0) {
|
||||
|
||||
@@ -2148,7 +2148,7 @@ int isp_capture_release(
|
||||
if (err < 0) {
|
||||
dev_err(chan->isp_dev,
|
||||
"%s: release channel IVC failed\n", __func__);
|
||||
WARN_ON("RTCPU is in a bad state. Reboot to recover");
|
||||
pr_warn("RTCPU is in a bad state. Reboot to recover");
|
||||
|
||||
tegra_camrtc_reboot(capture->rtcpu_dev);
|
||||
|
||||
@@ -3482,7 +3482,7 @@ static int capture_isp_probe(struct platform_device *pdev)
|
||||
of_node_put(node);
|
||||
|
||||
if (ispdev == NULL) {
|
||||
dev_WARN(dev, "isp node %u has no device\n", i);
|
||||
dev_warn(dev, "isp node %u has no device\n", i);
|
||||
err = -ENODEV;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -324,7 +324,9 @@ int vi_channel_close_ex(
|
||||
|
||||
mutex_lock(&chan_drv->lock);
|
||||
|
||||
WARN_ON(rcu_access_pointer(chan_drv->channels[channel]) != chan);
|
||||
if (rcu_access_pointer(chan_drv->channels[channel]) != chan)
|
||||
dev_warn(chan_drv->dev, "%s: dev does not match\n", __func__);
|
||||
|
||||
RCU_INIT_POINTER(chan_drv->channels[channel], NULL);
|
||||
|
||||
mutex_unlock(&chan_drv->lock);
|
||||
@@ -894,7 +896,7 @@ int vi_channel_drv_register(
|
||||
mutex_lock(&chdrv_lock);
|
||||
if (chdrv_ != NULL) {
|
||||
mutex_unlock(&chdrv_lock);
|
||||
WARN_ON(1);
|
||||
dev_warn(chdrv_->dev, "%s: chdrv is busy\n", __func__);
|
||||
err = -EBUSY;
|
||||
goto error;
|
||||
}
|
||||
@@ -985,8 +987,8 @@ void vi_channel_drv_unregister(
|
||||
mutex_lock(&chdrv_lock);
|
||||
chan_drv = chdrv_;
|
||||
chdrv_ = NULL;
|
||||
|
||||
WARN_ON(&chan_drv->vi_capture_pdev->dev != dev);
|
||||
if (chan_drv->dev != dev)
|
||||
dev_warn(chan_drv->dev, "%s: dev does not match\n", __func__);
|
||||
mutex_unlock(&chdrv_lock);
|
||||
|
||||
if (vi_channel_major < 0) {
|
||||
|
||||
@@ -928,16 +928,16 @@ int vi_capture_setup(
|
||||
dev_dbg(chan->dev, "vi unit id %u\n", vi_inst);
|
||||
dev_dbg(chan->dev, "vi2 chan mask %llx\n", setup->vi2_channel_mask);
|
||||
|
||||
if (WARN_ON(vi_inst == VI_UNIT_VI &&
|
||||
if ((vi_inst == VI_UNIT_VI &&
|
||||
setup->vi_channel_mask == CAPTURE_CHANNEL_INVALID_MASK) ||
|
||||
WARN_ON(vi_inst == VI_UNIT_VI2 &&
|
||||
(vi_inst == VI_UNIT_VI2 &&
|
||||
setup->vi2_channel_mask == CAPTURE_CHANNEL_INVALID_MASK) ||
|
||||
WARN_ON(setup->channel_flags == 0) ||
|
||||
WARN_ON(setup->queue_depth == 0) ||
|
||||
WARN_ON(setup->request_size == 0) ||
|
||||
WARN_ON(setup->csi_stream_id == NVCSI_STREAM_INVALID_ID)) {
|
||||
setup->channel_flags == 0 ||
|
||||
setup->queue_depth == 0 ||
|
||||
setup->request_size == 0 ||
|
||||
setup->csi_stream_id == NVCSI_STREAM_INVALID_ID) {
|
||||
|
||||
dev_err(chan->dev, "%s: invalid setup parameters\n", __func__);
|
||||
dev_warn(chan->dev, "%s: invalid setup parameters\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -978,15 +978,16 @@ int vi_capture_setup(
|
||||
goto memoryinfo_alloc_fail;
|
||||
}
|
||||
|
||||
WARN_ON(capture->unpins_list != NULL);
|
||||
if (capture->unpins_list != NULL)
|
||||
dev_warn(chan->dev, "%s: unpins_list is not NULL\n", __func__);
|
||||
|
||||
capture->unpins_list =
|
||||
vzalloc(setup->queue_depth * sizeof(*capture->unpins_list));
|
||||
|
||||
if (!capture->unpins_list) {
|
||||
dev_err(chan->dev,
|
||||
"%s: channel_unpins alloc failed\n", __func__);
|
||||
goto unpin_alloc_fail;
|
||||
dev_err(chan->dev,
|
||||
"%s: channel_unpins alloc failed\n", __func__);
|
||||
goto unpin_alloc_fail;
|
||||
}
|
||||
|
||||
config->requests_memoryinfo = capture->requests_memoryinfo_iova;
|
||||
@@ -1288,10 +1289,8 @@ int vi_capture_release(
|
||||
err = vi_capture_ivc_send_control(chan, &control_desc,
|
||||
sizeof(control_desc), CAPTURE_CHANNEL_RELEASE_RESP);
|
||||
if (err < 0) {
|
||||
dev_err(chan->dev,
|
||||
"%s: release channel IVC failed\n", __func__);
|
||||
WARN_ON("RTCPU is in a bad state. Reboot to recover");
|
||||
|
||||
dev_warn(chan->dev,
|
||||
"%s: release channel IVC failed, reboot RTCPU to recover\n", __func__);
|
||||
tegra_camrtc_reboot(chan->rtcpu_dev);
|
||||
|
||||
err = -EIO;
|
||||
@@ -2327,7 +2326,7 @@ static int capture_vi_probe(struct platform_device *pdev)
|
||||
of_node_put(np);
|
||||
|
||||
if (pvidev == NULL) {
|
||||
dev_WARN(dev, "vi node %d has no device\n", ii);
|
||||
dev_warn(dev, "vi node %d has no device\n", ii);
|
||||
err = -ENODEV;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -206,8 +206,10 @@ static ssize_t tegra_camchar_read(struct file *fp, char __user *buffer, size_t l
|
||||
DEFINE_WAIT(wait);
|
||||
ssize_t ret;
|
||||
|
||||
if (WARN_ON(!ch->is_ready))
|
||||
if (!ch->is_ready) {
|
||||
dev_warn(&ch->dev, "%s: dev is not ready!\n", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
len = min_t(size_t, len, ch->ivc.frame_size);
|
||||
if (len == 0)
|
||||
@@ -246,7 +248,7 @@ static ssize_t tegra_camchar_read(struct file *fp, char __user *buffer, size_t l
|
||||
* - Obtains the device-specific data by calling
|
||||
* @ref tegra_ivc_channel_get_drvdata().
|
||||
* - Defines a wait queue using @ref DEFINE_WAIT().
|
||||
* - Checks if the channel is ready using @ref WARN_ON().
|
||||
* - Checks if the channel is ready.
|
||||
* - Limits the write length to the minimum of the requested length and the
|
||||
* channel's frame size using @ref min_t().
|
||||
* - If the adjusted length is zero, returns 0 indicating no data to write.
|
||||
@@ -277,8 +279,7 @@ static ssize_t tegra_camchar_read(struct file *fp, char __user *buffer, size_t l
|
||||
* @param[in, out] offset File position offset.
|
||||
* Valid Value: non-NULL.
|
||||
*
|
||||
* @retval -EIO If the channel is not ready, as determined by
|
||||
* @ref WARN_ON().
|
||||
* @retval -EIO If the channel is not ready.
|
||||
* @retval 0 If the adjusted write length is zero.
|
||||
* @retval -EINTR If the write operation was interrupted by a signal,
|
||||
* as determined by @ref mutex_lock_interruptible()
|
||||
@@ -298,8 +299,10 @@ static ssize_t tegra_camchar_write(struct file *fp, const char __user *buffer,
|
||||
DEFINE_WAIT(wait);
|
||||
ssize_t ret;
|
||||
|
||||
if (WARN_ON(!ch->is_ready))
|
||||
if (!ch->is_ready) {
|
||||
dev_warn(&ch->dev, "%s: dev is not ready!\n", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
len = min_t(size_t, len, ch->ivc.frame_size);
|
||||
if (len == 0)
|
||||
|
||||
@@ -54,8 +54,11 @@ static int tegra_capture_ivc_tx_(struct tegra_capture_ivc *civc,
|
||||
int ret;
|
||||
|
||||
chan = civc->chan;
|
||||
if (chan == NULL || WARN_ON(!chan->is_ready))
|
||||
if (chan == NULL || !chan->is_ready) {
|
||||
if (chan != NULL)
|
||||
dev_warn(&chan->dev, "%s: dev is not ready!\n", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ret = mutex_lock_interruptible(&civc->ivc_wr_lock);
|
||||
if (unlikely(ret == -EINTR))
|
||||
@@ -143,8 +146,10 @@ static int tegra_capture_ivc_tx(struct tegra_capture_ivc *civc,
|
||||
*/
|
||||
int tegra_capture_ivc_control_submit(const void *control_desc, size_t len)
|
||||
{
|
||||
if (WARN_ON(__scivc_control == NULL))
|
||||
if (__scivc_control == NULL) {
|
||||
pr_warn("%s: __scivc_control is NULL!\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return tegra_capture_ivc_tx(__scivc_control, control_desc, len);
|
||||
}
|
||||
@@ -167,8 +172,10 @@ EXPORT_SYMBOL(tegra_capture_ivc_control_submit);
|
||||
*/
|
||||
int tegra_capture_ivc_capture_submit(const void *capture_desc, size_t len)
|
||||
{
|
||||
if (WARN_ON(__scivc_capture == NULL))
|
||||
if (__scivc_capture == NULL) {
|
||||
pr_warn("%s: __scivc_capture is NULL!\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return tegra_capture_ivc_tx(__scivc_capture, capture_desc, len);
|
||||
}
|
||||
@@ -218,12 +225,20 @@ int tegra_capture_ivc_register_control_cb(
|
||||
int ret;
|
||||
|
||||
/* Check if inputs are valid */
|
||||
if (WARN(control_resp_cb == NULL, "callback function is NULL"))
|
||||
if (control_resp_cb == NULL) {
|
||||
pr_warn("%s: callback function is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
if (WARN(trans_id == NULL, "return value trans_id is NULL"))
|
||||
}
|
||||
|
||||
if (trans_id == NULL) {
|
||||
pr_warn("%s: return value trans_id is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
if (WARN_ON(!__scivc_control))
|
||||
}
|
||||
|
||||
if (!__scivc_control) {
|
||||
pr_warn("%s: invalid __scivc_control\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
civc = __scivc_control;
|
||||
|
||||
@@ -247,16 +262,16 @@ int tegra_capture_ivc_register_control_cb(
|
||||
|
||||
ctx_id = cb_ctx - &civc->cb_ctx[0];
|
||||
|
||||
if (WARN(ctx_id < TRANS_ID_START_IDX ||
|
||||
ctx_id >= ARRAY_SIZE(civc->cb_ctx),
|
||||
"invalid cb_ctx %zu", ctx_id)) {
|
||||
if (ctx_id < TRANS_ID_START_IDX ||
|
||||
ctx_id >= ARRAY_SIZE(civc->cb_ctx)) {
|
||||
ret = -EIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
mutex_lock(&civc->cb_ctx_lock);
|
||||
|
||||
if (WARN(cb_ctx->cb_func != NULL, "cb_ctx is busy")) {
|
||||
if (cb_ctx->cb_func != NULL) {
|
||||
pr_warn("%s: cb_ctx is not NULL\n", __func__);
|
||||
ret = -EIO;
|
||||
goto locked_fail;
|
||||
}
|
||||
@@ -312,13 +327,21 @@ int tegra_capture_ivc_notify_chan_id(uint32_t chan_id, uint32_t trans_id)
|
||||
{
|
||||
struct tegra_capture_ivc *civc;
|
||||
|
||||
if (WARN(chan_id >= NUM_CAPTURE_CHANNELS, "invalid chan_id"))
|
||||
if (chan_id >= NUM_CAPTURE_CHANNELS) {
|
||||
pr_warn("%s: invalid chan_id\n", __func__);
|
||||
return -EINVAL;
|
||||
if (WARN(trans_id < TRANS_ID_START_IDX ||
|
||||
trans_id >= TOTAL_CHANNELS, "invalid trans_id"))
|
||||
}
|
||||
|
||||
if (trans_id < TRANS_ID_START_IDX ||
|
||||
trans_id >= TOTAL_CHANNELS) {
|
||||
pr_warn("%s: invalid trans_id\n", __func__);
|
||||
return -EINVAL;
|
||||
if (WARN_ON(!__scivc_control))
|
||||
}
|
||||
|
||||
if (!__scivc_control) {
|
||||
pr_warn("%s: invalid __scivc_control\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
chan_id = array_index_nospec(chan_id, NUM_CAPTURE_CHANNELS);
|
||||
trans_id = array_index_nospec(trans_id, TOTAL_CHANNELS);
|
||||
@@ -327,14 +350,14 @@ int tegra_capture_ivc_notify_chan_id(uint32_t chan_id, uint32_t trans_id)
|
||||
|
||||
mutex_lock(&civc->cb_ctx_lock);
|
||||
|
||||
if (WARN(civc->cb_ctx[trans_id].cb_func == NULL,
|
||||
"transaction context at %u is idle", trans_id)) {
|
||||
if (civc->cb_ctx[trans_id].cb_func == NULL) {
|
||||
pr_warn("%s: transaction context at %u is idle\n", __func__, trans_id);
|
||||
mutex_unlock(&civc->cb_ctx_lock);
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
if (WARN(civc->cb_ctx[chan_id].cb_func != NULL,
|
||||
"channel context at %u is busy", chan_id)) {
|
||||
if (civc->cb_ctx[chan_id].cb_func != NULL) {
|
||||
pr_warn("%s: channel context at %u is busy\n", __func__, chan_id);
|
||||
mutex_unlock(&civc->cb_ctx_lock);
|
||||
return -EBUSY;
|
||||
}
|
||||
@@ -393,12 +416,15 @@ int tegra_capture_ivc_register_capture_cb(
|
||||
struct tegra_capture_ivc *civc;
|
||||
int ret;
|
||||
|
||||
if (WARN(capture_status_ind_cb == NULL, "callback function is NULL"))
|
||||
if (capture_status_ind_cb == NULL) {
|
||||
pr_warn("%s: callback function is NULL\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (WARN(chan_id >= NUM_CAPTURE_CHANNELS,
|
||||
"invalid channel id %u", chan_id))
|
||||
if (chan_id >= NUM_CAPTURE_CHANNELS) {
|
||||
pr_warn("%s: invalid channel id %u\n", __func__, chan_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
chan_id = array_index_nospec(chan_id, NUM_CAPTURE_CHANNELS);
|
||||
|
||||
if (!__scivc_capture)
|
||||
@@ -412,8 +438,8 @@ int tegra_capture_ivc_register_capture_cb(
|
||||
|
||||
mutex_lock(&civc->cb_ctx_lock);
|
||||
|
||||
if (WARN(civc->cb_ctx[chan_id].cb_func != NULL,
|
||||
"capture channel %u is busy", chan_id)) {
|
||||
if (civc->cb_ctx[chan_id].cb_func != NULL) {
|
||||
pr_warn("%s: capture channel %u is busy\n", __func__, chan_id);
|
||||
ret = -EBUSY;
|
||||
goto fail;
|
||||
}
|
||||
@@ -460,10 +486,14 @@ int tegra_capture_ivc_unregister_control_cb(uint32_t id)
|
||||
struct tegra_capture_ivc *civc;
|
||||
|
||||
/* id could be temporary trans_id or rtcpu-allocated chan_id */
|
||||
if (WARN(id >= TOTAL_CHANNELS, "invalid id %u", id))
|
||||
if (id >= TOTAL_CHANNELS) {
|
||||
pr_warn("%s: invalid id %u\n", __func__, id);
|
||||
return -EINVAL;
|
||||
if (WARN_ON(!__scivc_control))
|
||||
}
|
||||
if (!__scivc_control) {
|
||||
pr_warn("%s: __scivc_control is not exist!\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
id = array_index_nospec(id, TOTAL_CHANNELS);
|
||||
|
||||
@@ -471,8 +501,8 @@ int tegra_capture_ivc_unregister_control_cb(uint32_t id)
|
||||
|
||||
mutex_lock(&civc->cb_ctx_lock);
|
||||
|
||||
if (WARN(civc->cb_ctx[id].cb_func == NULL,
|
||||
"control channel %u is idle", id)) {
|
||||
if (civc->cb_ctx[id].cb_func == NULL) {
|
||||
pr_warn("%s: control channel %u is idle\n", __func__, id);
|
||||
mutex_unlock(&civc->cb_ctx_lock);
|
||||
return -EBADF;
|
||||
}
|
||||
@@ -535,8 +565,8 @@ int tegra_capture_ivc_unregister_capture_cb(uint32_t chan_id)
|
||||
|
||||
mutex_lock(&civc->cb_ctx_lock);
|
||||
|
||||
if (WARN(civc->cb_ctx[chan_id].cb_func == NULL,
|
||||
"capture channel %u is idle", chan_id)) {
|
||||
if (civc->cb_ctx[chan_id].cb_func == NULL) {
|
||||
pr_warn("%s: capture channel %u is idle\n", __func__, chan_id);
|
||||
mutex_unlock(&civc->cb_ctx_lock);
|
||||
return -EBADF;
|
||||
}
|
||||
@@ -632,7 +662,7 @@ static inline void tegra_capture_ivc_recv(struct tegra_capture_ivc *civc)
|
||||
id = array_index_nospec(id, TOTAL_CHANNELS);
|
||||
tegra_capture_ivc_recv_msg(civc, id, msg);
|
||||
} else {
|
||||
dev_WARN(dev, "Invalid rtcpu channel id %u", id);
|
||||
dev_warn(dev, "Invalid rtcpu channel id %u", id);
|
||||
}
|
||||
|
||||
tegra_ivc_read_advance(ivc);
|
||||
@@ -646,7 +676,7 @@ static inline void tegra_capture_ivc_recv(struct tegra_capture_ivc *civc)
|
||||
* - Retrieves the capture IVC context from the work structure using @ref container_of()
|
||||
* - Acquires a runtime PM reference to prevent suspended operation using
|
||||
* @ref pm_runtime_get_if_in_use()
|
||||
* - If channel is not ready, logs a warning using @ref WARN_ON()
|
||||
* - If channel is not ready, logs a warning.
|
||||
* - Verifies that the channel is ready using @ref chan->is_ready
|
||||
* - Calls @ref tegra_capture_ivc_recv() to process all pending messages
|
||||
* - Releases the runtime PM reference using @ref pm_runtime_put()
|
||||
@@ -668,7 +698,9 @@ static void tegra_capture_ivc_worker(struct kthread_work *work)
|
||||
* notify when RCE resumes and IVC bus gets set up.
|
||||
*/
|
||||
if (pm_runtime_get_if_in_use(&chan->dev) > 0) {
|
||||
WARN_ON(!chan->is_ready);
|
||||
if (!chan->is_ready) {
|
||||
dev_warn(&chan->dev, "channel not ready\n");
|
||||
}
|
||||
|
||||
tegra_capture_ivc_recv(civc);
|
||||
|
||||
@@ -726,10 +758,10 @@ static void tegra_capture_ivc_notify(struct tegra_ivc_channel *chan)
|
||||
* - Unlocks the callback context lock using @ref mutex_unlock()
|
||||
* - Associates the context with the IVC channel using @ref tegra_ivc_channel_set_drvdata()
|
||||
* - Checks if the service type is "capture-control" using @ref strcmp()
|
||||
* - Verifies that no control channel already exists using @ref WARN_ON()
|
||||
* - Verifies that no control channel already exists
|
||||
* - Registers the context as a control service by setting @ref __scivc_control
|
||||
* - If not control, checks if service type is "capture" using @ref strcmp()
|
||||
* - Verifies that no capture channel already exists using @ref WARN_ON()
|
||||
* - Verifies that no capture channel already exists
|
||||
* - Registers the context as a capture service by setting @ref __scivc_capture
|
||||
* - Returns error if service type is neither control nor capture
|
||||
* - Stops the worker thread using @ref kthread_stop() if an error occurs
|
||||
@@ -798,13 +830,15 @@ static int tegra_capture_ivc_probe(struct tegra_ivc_channel *chan)
|
||||
tegra_ivc_channel_set_drvdata(chan, civc);
|
||||
|
||||
if (!strcmp("capture-control", service)) {
|
||||
if (WARN_ON(__scivc_control != NULL)) {
|
||||
if (__scivc_control != NULL) {
|
||||
dev_warn(&chan->dev, "%s: __scivc_control already exists!\n", __func__);
|
||||
ret = -EEXIST;
|
||||
goto err_service;
|
||||
}
|
||||
__scivc_control = civc;
|
||||
} else if (!strcmp("capture", service)) {
|
||||
if (WARN_ON(__scivc_capture != NULL)) {
|
||||
if (__scivc_capture != NULL) {
|
||||
dev_warn(&chan->dev, "%s: __scivc_capture already exists!\n", __func__);
|
||||
ret = -EEXIST;
|
||||
goto err_service;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ static int camrtc_hsp_sendrecv(struct camrtc_hsp *camhsp,
|
||||
* It processes the received message and performs the appropriate action:
|
||||
* - Retrieves the HSP context using @ref dev_get_drvdata()
|
||||
* - Extracts status and group information from the message
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context
|
||||
* - Handles unknown messages using @ref dev_dbg()
|
||||
* - Calls the group notification callback if a group notification is received
|
||||
* - For response messages, sets the response and wakes up waiters using @ref atomic_set() and @ref wake_up()
|
||||
@@ -194,8 +194,10 @@ static void camrtc_hsp_rx_full_notify(mbox_client *cl, void *data)
|
||||
status >>= CAMRTC_HSP_SS_FW_SHIFT;
|
||||
group = status & CAMRTC_HSP_SS_IVC_MASK;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
dev_warn(cl->dev, "%s: camhsp is NULL!\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CAMRTC_HSP_MSG_ID(msg) == CAMRTC_HSP_UNKNOWN)
|
||||
dev_dbg(&camhsp->dev, "request message unknown 0x%08x\n", msg);
|
||||
@@ -392,7 +394,7 @@ static int camrtc_hsp_vm_sendrecv(struct camrtc_hsp *camhsp,
|
||||
*
|
||||
* This function reads and processes boot log messages from the RTCPU during
|
||||
* the initialization process. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Uses @ref camrtc_hsp_recv() to wait for and receive boot log messages
|
||||
* - Processes different types of boot messages (complete, stage, error)
|
||||
* - Logs messages at appropriate log levels using @ref dev_info(), @ref dev_dbg(), and @ref dev_err()
|
||||
@@ -409,8 +411,10 @@ static int camrtc_hsp_vm_read_boot_log(struct camrtc_hsp *camhsp)
|
||||
uint32_t boot_log;
|
||||
long msg_timeout;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
pr_warn("%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
msg_timeout = camhsp->timeout;
|
||||
|
||||
@@ -839,7 +843,7 @@ fail:
|
||||
*
|
||||
* This function rings a group doorbell by calling the group_ring operation
|
||||
* on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Calls the group_ring operation on the HSP context using @ref group_ring()
|
||||
*
|
||||
* @param[in] camhsp Pointer to the camera HSP context
|
||||
@@ -850,7 +854,9 @@ fail:
|
||||
void camrtc_hsp_group_ring(struct camrtc_hsp *camhsp,
|
||||
u16 group)
|
||||
{
|
||||
if (!WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL)
|
||||
pr_warn("%s: camhsp is NULL!\n", __func__);
|
||||
else
|
||||
camhsp->op->group_ring(camhsp, group);
|
||||
}
|
||||
EXPORT_SYMBOL(camrtc_hsp_group_ring);
|
||||
@@ -860,7 +866,7 @@ EXPORT_SYMBOL(camrtc_hsp_group_ring);
|
||||
*
|
||||
* This function synchronizes the HSP by calling the sync operation
|
||||
* on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Locks the mutex using @ref mutex_lock()
|
||||
* - Calls the sync operation on the HSP context using @ref sync()
|
||||
* - Unlocks the mutex using @ref mutex_unlock()
|
||||
@@ -876,8 +882,10 @@ int camrtc_hsp_sync(struct camrtc_hsp *camhsp)
|
||||
long timeout;
|
||||
int response;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
pr_warn("%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
timeout = camhsp->timeout;
|
||||
mutex_lock(&camhsp->mutex);
|
||||
@@ -893,7 +901,7 @@ EXPORT_SYMBOL(camrtc_hsp_sync);
|
||||
*
|
||||
* This function resumes the HSP by calling the resume operation
|
||||
* on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Locks the mutex using @ref mutex_lock()
|
||||
* - Calls the resume operation on the HSP context using @ref resume()
|
||||
* - Unlocks the mutex using @ref mutex_unlock()
|
||||
@@ -909,8 +917,10 @@ int camrtc_hsp_resume(struct camrtc_hsp *camhsp)
|
||||
long timeout;
|
||||
int response;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
pr_warn("%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
timeout = camhsp->timeout;
|
||||
mutex_lock(&camhsp->mutex);
|
||||
@@ -926,7 +936,7 @@ EXPORT_SYMBOL(camrtc_hsp_resume);
|
||||
*
|
||||
* This function suspends the HSP by calling the suspend operation
|
||||
* on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Locks the mutex using @ref mutex_lock()
|
||||
* - Calls the suspend operation on the HSP context using @ref suspend()
|
||||
* - Unlocks the mutex using @ref mutex_unlock()
|
||||
@@ -943,8 +953,10 @@ int camrtc_hsp_suspend(struct camrtc_hsp *camhsp)
|
||||
long timeout;
|
||||
int response;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
pr_warn("%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
timeout = camhsp->timeout;
|
||||
mutex_lock(&camhsp->mutex);
|
||||
@@ -964,7 +976,7 @@ EXPORT_SYMBOL(camrtc_hsp_suspend);
|
||||
*
|
||||
* This function sets the operating point for the HSP by calling the set_operating_point
|
||||
* operation on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Locks the mutex using @ref mutex_lock()
|
||||
* - Calls the set_operating_point operation on the HSP context using @ref set_operating_point()
|
||||
* - Unlocks the mutex using @ref mutex_unlock()
|
||||
@@ -983,8 +995,10 @@ int camrtc_hsp_set_operating_point(struct camrtc_hsp *camhsp, uint32_t operating
|
||||
long timeout;
|
||||
int response;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
pr_warn("%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
timeout = camhsp->timeout;
|
||||
mutex_lock(&camhsp->mutex);
|
||||
@@ -1004,7 +1018,7 @@ EXPORT_SYMBOL(camrtc_hsp_set_operating_point);
|
||||
*
|
||||
* This function sends a BYE message to the HSP by calling the bye operation
|
||||
* on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Locks the mutex using @ref mutex_lock()
|
||||
* - Calls the bye operation on the HSP context using @ref bye()
|
||||
* - Unlocks the mutex using @ref mutex_unlock()
|
||||
@@ -1020,8 +1034,10 @@ int camrtc_hsp_bye(struct camrtc_hsp *camhsp)
|
||||
long timeout;
|
||||
int response;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
pr_warn("%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
timeout = camhsp->timeout;
|
||||
mutex_lock(&camhsp->mutex);
|
||||
@@ -1040,7 +1056,7 @@ EXPORT_SYMBOL(camrtc_hsp_bye);
|
||||
*
|
||||
* This function sets up the HSP channel by calling the ch_setup operation
|
||||
* on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Locks the mutex using @ref mutex_lock()
|
||||
* - Calls the ch_setup operation on the HSP context using @ref ch_setup()
|
||||
* - Unlocks the mutex using @ref mutex_unlock()
|
||||
@@ -1058,8 +1074,10 @@ int camrtc_hsp_ch_setup(struct camrtc_hsp *camhsp, dma_addr_t iova)
|
||||
long timeout;
|
||||
int response;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
pr_warn("%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (iova >= BIT_ULL(32) || (iova & 0xffU) != 0) {
|
||||
dev_warn(&camhsp->dev,
|
||||
@@ -1084,7 +1102,7 @@ EXPORT_SYMBOL(camrtc_hsp_ch_setup);
|
||||
*
|
||||
* This function pings the HSP by calling the ping operation
|
||||
* on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Locks the mutex using @ref mutex_lock()
|
||||
* - Calls the ping operation on the HSP context using @ref ping()
|
||||
* - Unlocks the mutex using @ref mutex_unlock()
|
||||
@@ -1104,8 +1122,10 @@ int camrtc_hsp_ping(struct camrtc_hsp *camhsp, u32 data, long timeout)
|
||||
long left = timeout;
|
||||
int response;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
dev_warn(&camhsp->dev, "%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (left == 0L)
|
||||
left = camhsp->timeout;
|
||||
@@ -1123,7 +1143,7 @@ EXPORT_SYMBOL(camrtc_hsp_ping);
|
||||
*
|
||||
* This function gets the firmware hash for the HSP by calling the get_fw_hash operation
|
||||
* on the HSP context. It performs the following operations:
|
||||
* - Validates the HSP context using @ref WARN_ON()
|
||||
* - Validates the HSP context is non-NULL
|
||||
* - Locks the mutex using @ref mutex_lock()
|
||||
* - Calls the get_fw_hash operation on the HSP context using @ref get_fw_hash()
|
||||
* - Unlocks the mutex using @ref mutex_unlock()
|
||||
@@ -1147,8 +1167,10 @@ int camrtc_hsp_get_fw_hash(struct camrtc_hsp *camhsp,
|
||||
int ret = 0;
|
||||
long timeout;
|
||||
|
||||
if (WARN_ON(camhsp == NULL))
|
||||
if (camhsp == NULL) {
|
||||
dev_warn(&camhsp->dev, "%s: camhsp is NULL!\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memset(hash, 0, hash_size);
|
||||
timeout = camhsp->timeout;
|
||||
|
||||
@@ -706,7 +706,8 @@ static void tegra_ivc_bus_remove(struct device *dev)
|
||||
struct tegra_ivc_channel *chan = to_tegra_ivc_channel(dev);
|
||||
const struct tegra_ivc_channel_ops *ops = drv->ops.channel;
|
||||
|
||||
WARN_ON(rcu_access_pointer(chan->ops) != ops);
|
||||
if (rcu_access_pointer(chan->ops) != ops)
|
||||
dev_warn(dev, "dev ops does not match!\n");
|
||||
RCU_INIT_POINTER(chan->ops, NULL);
|
||||
synchronize_rcu();
|
||||
|
||||
|
||||
@@ -1247,8 +1247,10 @@ static int camrtc_test_run_and_show_result(struct seq_file *file,
|
||||
const char *nul;
|
||||
|
||||
(void)__builtin_usubl_overflow(resp_size, data_offset, &result_size);
|
||||
if (WARN_ON(test_case_size > camrtc_dbgfs_get_max_test_size(ch)))
|
||||
if (test_case_size > camrtc_dbgfs_get_max_test_size(ch)) {
|
||||
dev_warn(&ch->dev, "%s: test_case_size > camrtc_dbgfs_get_max_test_size(ch)\n", __func__);
|
||||
test_case_size = camrtc_dbgfs_get_max_test_size(ch);
|
||||
}
|
||||
|
||||
memcpy((char *)req + data_offset, test_case, test_case_size);
|
||||
|
||||
@@ -1633,7 +1635,9 @@ static int camrtc_run_mem_test(struct seq_file *file,
|
||||
continue;
|
||||
|
||||
testmem = &resp->data.run_mem_test_data.mem[i];
|
||||
if (!WARN_ON(testmem->size > mem->size))
|
||||
if (testmem->size > mem->size)
|
||||
dev_warn(mem_dev, "%s: testmem->size > mem->size\n", __func__);
|
||||
else
|
||||
mem->used = testmem->size;
|
||||
|
||||
if (_camdbg_rmem.enabled) {
|
||||
|
||||
@@ -488,7 +488,6 @@ static inline void rtcpu_trace_exceptions(struct tegra_rtcpu_trace *tracer)
|
||||
return;
|
||||
|
||||
if (new_next >= tracer->exception_entries) {
|
||||
WARN_ON_ONCE(new_next >= tracer->exception_entries);
|
||||
dev_warn_ratelimited(tracer->dev,
|
||||
"exception entry %u outside range 0..%u\n",
|
||||
new_next, tracer->exception_entries - 1);
|
||||
@@ -1837,7 +1836,6 @@ static inline void rtcpu_trace_events(struct tegra_rtcpu_trace *tracer)
|
||||
struct camrtc_event_struct *event, *last_event;
|
||||
|
||||
if (new_next >= tracer->event_entries) {
|
||||
WARN_ON_ONCE(new_next >= tracer->event_entries);
|
||||
dev_warn_ratelimited(tracer->dev,
|
||||
"trace entry %u outside range 0..%u\n",
|
||||
new_next, tracer->event_entries - 1);
|
||||
@@ -1985,12 +1983,9 @@ static int32_t raw_trace_read_impl(
|
||||
int64_t mul_value = 0;
|
||||
|
||||
if (new_next >= tracer->event_entries) {
|
||||
WARN_ON_ONCE(new_next >= tracer->event_entries);
|
||||
dev_warn_ratelimited(
|
||||
tracer->dev,
|
||||
dev_warn_ratelimited(tracer->dev,
|
||||
"trace entry %u outside range 0..%u\n",
|
||||
new_next,
|
||||
tracer->event_entries - 1);
|
||||
new_next, tracer->event_entries - 1);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user