Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4626905pxj; Wed, 12 May 2021 09:32:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxijNOdoKU0H/NzpUfcG8arlTtM4QRep6lyMUo6jt+4ilhLPyaO+9JED6Hv7Gz9R7a2Vnp/ X-Received: by 2002:a17:906:22c6:: with SMTP id q6mr38451226eja.275.1620837127608; Wed, 12 May 2021 09:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837127; cv=none; d=google.com; s=arc-20160816; b=xpjK6++BI0CqjEBdVONQKBIkK1SWwAcCCkNH5K0O/U4hHF3krYlHEuYKE84J1I040U ev2Q8LigADdrg/DPDPrSyF+bEYXBh6KRNL0agSVLUpEmPqFAF73vIHHFAI3vetetN5Di HQNr9ss0qCAXPNQ+oHzFAReMphjP7BNhklHVUsWcSXVFXbmJO/JYioX1vYdf3US5FCvP z/5BEsY21nSLYbuvh7WsbvsPiPQDYqWggOayixWRuWnLDjBxkgGTFJmPmHimPyX5TBak G9QSxgcMV1t3ThLFe4xLEWXy2B3VL2D3IIRpQXn3mMc/688Li/h9/dG3SHckFB2NxuSq tpUw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dfylh86r3xUlM3YQStcoeDxToDrcoriP8wA1FQjJcn4=; b=EOZVhFZ953exZ/6uzdZurY7HLlKAqWqPY71RpchJy+Hb+Vlw8nXMz0Lw4B9qtiboU1 93nGIhl82/NwurjJHU4MpcrkDgLrD//Vx2jZSQY5m9ZBuTgtQN9froOVvyElKN02Qv+d eVe15BN36RKyAEbGahEWKxbF/8bAWGxvVRIMasD8+z422siV7Nmm3N+HHj2qtv28Bzev Xk8mLBTjygX1efQ5gsK2jmEthHGlpGqmXHku+8gO0EMS4ccEDjZ54gegMxzYMJpU8ynG FXdnCAL8NmU1OXC6N/WGO/TVeBgMdMHE2hi5b4W/lgfL/iQ8N+66R5XBURPhySBL8UAc 6hOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cV6T0adt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si129460edd.384.2021.05.12.09.31.42; Wed, 12 May 2021 09:32:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cV6T0adt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241774AbhELQar (ORCPT + 99 others); Wed, 12 May 2021 12:30:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:56710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234329AbhELPj1 (ORCPT ); Wed, 12 May 2021 11:39:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4B44D61999; Wed, 12 May 2021 15:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832851; bh=V/dy9IMMiM5va/oUmVRpwWXpVG2lay9+73TYeNd+1nE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cV6T0adtaFBpYwVZAQV7/6AZ+U5EqQ++59VN1yZqOz7wXxwMtIBIQS5aVSZj86SFF Dh2WaZ0z0hZzDK+fvGgzFSq+rThgzaDFKEuf8QoVGTyP8TUIwpSgoAVsKz/LGnuNGz tqVXIqOQ9DejOhJZC25/fyCfzen61zNCHayxYqVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Zhenyu Wang , Sasha Levin Subject: [PATCH 5.10 450/530] drm/i915/gvt: Fix error code in intel_gvt_init_device() Date: Wed, 12 May 2021 16:49:20 +0200 Message-Id: <20210512144834.553629710@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 329328ec6a87f2c1275f50d979d55513de458409 ] The intel_gvt_init_vgpu_type_groups() function is only called from intel_gvt_init_device(). If it fails then the intel_gvt_init_device() prints the error code and propagates it back again. That's a bug because false is zero/success. The fix is to modify it to return zero or negative error codes and make everything consistent. Fixes: c5d71cb31723 ("drm/i915/gvt: Move vGPU type related code into gvt file") Signed-off-by: Dan Carpenter Signed-off-by: Zhenyu Wang Link: http://patchwork.freedesktop.org/patch/msgid/YHaFQtk/DIVYK1u5@mwanda Reviewed-by: Zhenyu Wang Signed-off-by: Sasha Levin --- drivers/gpu/drm/i915/gvt/gvt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c index c7c561237883..5c9ef8e58a08 100644 --- a/drivers/gpu/drm/i915/gvt/gvt.c +++ b/drivers/gpu/drm/i915/gvt/gvt.c @@ -126,7 +126,7 @@ static bool intel_get_gvt_attrs(struct attribute_group ***intel_vgpu_type_groups return true; } -static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) +static int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) { int i, j; struct intel_vgpu_type *type; @@ -144,7 +144,7 @@ static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) gvt_vgpu_type_groups[i] = group; } - return true; + return 0; unwind: for (j = 0; j < i; j++) { @@ -152,7 +152,7 @@ unwind: kfree(group); } - return false; + return -ENOMEM; } static void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt) @@ -360,7 +360,7 @@ int intel_gvt_init_device(struct drm_i915_private *i915) goto out_clean_thread; ret = intel_gvt_init_vgpu_type_groups(gvt); - if (ret == false) { + if (ret) { gvt_err("failed to init vgpu type groups: %d\n", ret); goto out_clean_types; } -- 2.30.2