@@ -80,14 +80,14 @@ bool vbva_write(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
if (chunk >= available) {
vbva_buffer_flush(ctx);
available = vbva_buffer_available(vbva);
- }
-
- if (chunk >= available) {
- if (WARN_ON(available <= vbva->partial_write_tresh)) {
- vbva_ctx->buffer_overflow = true;
- return false;
+ if (chunk >= available) {
+ if (WARN_ON(available <= vbva->partial_write_tresh)) {
+ vbva_ctx->buffer_overflow = true;
+ return false;
+ }
+ chunk = available - vbva->partial_write_tresh;
}
- chunk = available - vbva->partial_write_tresh;
+
}
vbva_buffer_place_data_at(vbva_ctx, p, chunk,
In vbva_write(), We do not need to double check available chunk size if chunk is smaller than available buffer. Put the second if clause in the first if clause and avoid check twice. Signed-off-by: Sidong Yang <realwakka@gmail.com> --- drivers/gpu/drm/vboxvideo/vbva_base.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)