Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp965367iog; Thu, 30 Jun 2022 14:00:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vv/jsdAASB/6kxY1E1i9cM0LceJMzJT2+CyGDZvFlI9RhS1Yte+7S9fxZzh100MoPExVyM X-Received: by 2002:a17:90a:a08:b0:1ea:f03c:51f7 with SMTP id o8-20020a17090a0a0800b001eaf03c51f7mr12406101pjo.49.1656622824424; Thu, 30 Jun 2022 14:00:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656622824; cv=none; d=google.com; s=arc-20160816; b=ULIFtwCiA0VKP6uBgRj3CigEwdYJJStQzcLMZC9WjXJbC9H4RunigVvsyHX5B+VSNU 8gK8a4mHP6SSJ/7IizX5vFwoNxFdG2QiSZSnxSuncI37FTDuLFLhsxI4r/asdqLryQEg 0t6GInMYQwn33YNvMtuLIPGSQlQFKP1vubl2t72eUcPM56KD3KagICxxYgaHaKTbLxpJ KVQ0E9LYB57WEg0X+7bfqYLeiTNCPwC+wWQ12fP0PSKo2CVnJmT0KF9gtbCDs06yHZmN SGar3zTYpWNW37EQEIcMQbCSR+delmjpSqhJrZDsE32B89PuO++BYDcSG4Xn/5o8o5UR B+jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OJdFUTyxLWQ2bgBcDULs2jMSVTDhKR4+nSi1QNid2dc=; b=BlR+papm70IA7VGvYADAvBHZdtjsDm07VPRf+IVgjthl9juJgIR21Www+HneJJruRt 4Ym6XK7P8rVkVdCiHuNkN+L9eh2my71+pELyxO10cAEp6tolBKSSqUIK9Qs/3Qh6fKft 2TodJr5TtnEk6mTtwzB6o4r6Fp3Mjvzb8ptlwBbv0Fuh3vCapjct7oL6WFFuvjAbXq5i jyCuOsX7jAvZg644ZoclewJnzxB4zzAlJ6B55QfzDXu0yUlYRDGdFlsHD1hLNC0DoV5I S3F73Wbn+fAob3DpGhAqIUSo5GgW58u6DUBHj5GdNf7IdhSRV7GvxYSIwjBocrN9Cgrm hlsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=HZ2vEXyX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a170902700600b0016a607f8df7si1908383plk.110.2022.06.30.14.00.11; Thu, 30 Jun 2022 14:00:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=HZ2vEXyX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237125AbiF3UIW (ORCPT + 99 others); Thu, 30 Jun 2022 16:08:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237076AbiF3UIH (ORCPT ); Thu, 30 Jun 2022 16:08:07 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E22E45506 for ; Thu, 30 Jun 2022 13:08:04 -0700 (PDT) Received: from dimapc.. (109-252-118-164.nat.spd-mgts.ru [109.252.118.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 0FDB36601A30; Thu, 30 Jun 2022 21:08:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1656619682; bh=MzOopUjJq3tk9V0f5TEz4iy0ZSBWZue9l9nRV9B/kW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZ2vEXyX6KuWca354KrOgnGHyT+xu7SMFjusgPN/9keJ8LE+JhEw7LnrxBV6uKqAk 6iipIku0v1dHqDmfxAGQVgL1qO3fCF0ypHceRs13DjidPz6xggB12PxSUsxTXuKZOS 3xgxGRmnjKR+EetH5Cw7Bx1UwBeSEYeBfP1YfFf1s8eW4pYMbJDcGjoiifyTkFqeYV H+UvLu7JXTDwOSMzK8QXi8wupToEn2nEMlNhgTSbF8sCc7WT81MNzj6qrS2qDNlZc9 sCfyeRhge8Hm5WLvGHp6CJ/gJit4UkqGtb1x/JjGSoxdKz7p7CKy+exn/TR55BGXpS 5iicLRtUphgEA== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Thomas Zimmermann , Emil Velikov , Robin Murphy , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Dmitry Osipenko , kernel@collabora.com Subject: [PATCH v7 9/9] drm/virtio: Return proper error codes instead of -1 Date: Thu, 30 Jun 2022 23:07:26 +0300 Message-Id: <20220630200726.1884320-10-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220630200726.1884320-1-dmitry.osipenko@collabora.com> References: <20220630200726.1884320-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't return -1 in error cases, return proper error code. The returned error codes propagate to error messages and to userspace and it's always good to have a meaningful error number for debugging purposes. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/virtio/virtgpu_vq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index ee84256946ab..9ff8660b50ad 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -322,7 +322,7 @@ static int virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev, if (fence && vbuf->objs) virtio_gpu_array_unlock_resv(vbuf->objs); free_vbuf(vgdev, vbuf); - return -1; + return -ENODEV; } if (vgdev->has_indirect) @@ -386,7 +386,7 @@ static int virtio_gpu_queue_fenced_ctrl_buffer(struct virtio_gpu_device *vgdev, if (!sgt) { if (fence && vbuf->objs) virtio_gpu_array_unlock_resv(vbuf->objs); - return -1; + return -ENOMEM; } elemcnt += sg_ents; @@ -720,7 +720,7 @@ static int virtio_get_edid_block(void *data, u8 *buf, size_t start = block * EDID_LENGTH; if (start + len > le32_to_cpu(resp->size)) - return -1; + return -EINVAL; memcpy(buf, resp->edid + start, len); return 0; } -- 2.36.1