From patchwork Mon Jul 17 18:49:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 121560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1294673vqt; Mon, 17 Jul 2023 12:10:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlGDWJUdvuLlHeP+echN1xK6S1QN+81hx1VhNNZSY8MIbda53OxbhMWDYHS/k4rXc9aifb8h X-Received: by 2002:a05:6808:1388:b0:3a1:e12b:2f80 with SMTP id c8-20020a056808138800b003a1e12b2f80mr13238200oiw.35.1689621051908; Mon, 17 Jul 2023 12:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689621051; cv=none; d=google.com; s=arc-20160816; b=gmlF+JSVapFeQs3XQ77LBTwfa7O+1oJNbz4vFSVij6uZQGd+A78I7ZHIucSQPSEvwc cZXLBx/WAqHMsQjho7QrNUkRXN4BfEf0DjzBkjN884xKkDSExSiIA6KRg9KLpoTcOnhN 0IDdZIxiPBPP3OvF6Lk9z7DulpYsToiwVfyLx7Uphhhn3iZFaySGPBaU2P6xK2XF/4aR vRK3+Ta9ZpFB0vW102DPIBtR63frWsckQJRum9sEMfT6qLuvpJKAOA34i+GT5t+chM8Z MZ0Rwq8ey/1fAny8FpcnomfFBhcvL6qAKM4a4tiYMHQwriKS/Hc10qeE+jXfYKkrJm/d QxQA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=6EdZ+Gq8+oaEzVh78T6j0Vq20F8gxMukgxRTDtUERro=; fh=oJihAFSXyVQ34dtfXlEJV4Kkhj6c13zkRiLw/Uh+T5I=; b=IeZr8V6ht8zrgxnuqxVuNLZFW4XAILBRmLmp9AAs57MFMByeMHdsPFPbjftkyHKM1u jkPQHqG2DlOcKYCt5IbBmHv1F7k7DPDTj/vAKsGLkERqXxEWn8+QWSuUafhZQ/WNOzHp DNphBP8t1RZI3tyfdr2AzHGRxyvjqNjKQd5koZdK5yJtonNjd+Gor4gl5TTBa5UR1kcf pTAyP7hEqbE0OHPhE1AeRq2Zc2b1J5wBfc44MUQ0IL4c95qJXN+ciq/yYqkwjtQyD7Jo n8BlGphsI3F8vZjUW9jtjPmjRtJhz3fO64EgfkoJ+iY0h6cNJSyRBv7G5x3fA15AgB9f 3JMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=sxNEjaNa; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020a632702000000b005538c82b70esi264241pgn.101.2023.07.17.12.10.38; Mon, 17 Jul 2023 12:10:51 -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=@wanadoo.fr header.s=t20230301 header.b=sxNEjaNa; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231337AbjGQStk (ORCPT + 99 others); Mon, 17 Jul 2023 14:49:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjGQSti (ORCPT ); Mon, 17 Jul 2023 14:49:38 -0400 Received: from smtp.smtpout.orange.fr (smtp-13.smtpout.orange.fr [80.12.242.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C425A9D for ; Mon, 17 Jul 2023 11:49:37 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id LTHoqBKeeFmkzLTHoqiy4V; Mon, 17 Jul 2023 20:49:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1689619775; bh=6EdZ+Gq8+oaEzVh78T6j0Vq20F8gxMukgxRTDtUERro=; h=From:To:Cc:Subject:Date; b=sxNEjaNaSFGblebLhoZgCspR3/b7PMWw5mvvcbiA1JPdCVOiD0EcAzet5fqmrBLF0 g1kJA04ScN0oLMVrH4T0js02kJvMR5ByBFj85S3S263Cai7ZlGu9TueW4SLJB59Nxr yNr1SrsLma5wvNJutFL013ubT61mwc2VkIW7B1vS1WgiZEA39BUysRBJDv3H3rLPTb pWvr1ye+zaTo4e7HiCsKYaVJiH9p8aKlYdZ3+ZFyBSC7oBIXCzPJWWFrbUeDnCi/Zc ncTIfUd0VPZ4Pw8VuSOu+/IXZUpeo1Dk6aHUaxZTE3KzUG70NVHYvE+EHhauumpuxY R6XZR7RXCKgVw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 17 Jul 2023 20:49:35 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Matthew Auld , Maarten Lankhorst Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/i915: Fix an error handling path in igt_write_huge() Date: Mon, 17 Jul 2023 20:49:31 +0200 Message-Id: <7a036b88671312ee9adc01c74ef5b3376f690b76.1689619758.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771696083878769315 X-GMAIL-MSGID: 1771696083878769315 All error handling paths go to 'out', except this one. Be consistent and also branch to 'out' here. Fixes: c10a652e239e ("drm/i915/selftests: Rework context handling in hugepages selftests") Signed-off-by: Christophe JAILLET Reviewed-by: Andrzej Hajda Reviewed-by: Andi Shyti --- /!\ Speculative /!\ This patch is based on analysis of the surrounding code and should be reviewed with care ! If the patch is wrong, maybe a comment in the code could explain why. /!\ Speculative /!\ --- drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c index df6c9a84252c..6b9f6cf50bf6 100644 --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c @@ -1246,8 +1246,10 @@ static int igt_write_huge(struct drm_i915_private *i915, * times in succession a possibility by enlarging the permutation array. */ order = i915_random_order(count * count, &prng); - if (!order) - return -ENOMEM; + if (!order) { + err = -ENOMEM; + goto out; + } max_page_size = rounddown_pow_of_two(obj->mm.page_sizes.sg); max = div_u64(max - size, max_page_size);