From patchwork Sun Feb 11 15:09:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniil Dulov X-Patchwork-Id: 199474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1969706dyd; Sun, 11 Feb 2024 07:11:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkLt6/8X/oxqgPAcVvOut/vS8xW6cf/d9rupWQ38Kwb83LZ5kxefiT9MiBlTpktWQcz4YC4nqAkHnk5O6aJ2/ICtTxTQ== X-Google-Smtp-Source: AGHT+IGiwCBt5N8gQ9isUXQfYQk995fX5Z6OLjqKkHhctxwxd+s0Aab5Doh2Jr9+moNp8OVHqdl/ X-Received: by 2002:a05:6214:4388:b0:68c:56b5:3d7f with SMTP id oh8-20020a056214438800b0068c56b53d7fmr10273645qvb.8.1707664315179; Sun, 11 Feb 2024 07:11:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707664315; cv=pass; d=google.com; s=arc-20160816; b=UMnePdk2ZSboqaI+4QlkbvSe4CeE24YXJMMn2E06F+cbndKHHcUhe6FPAxTIjNmsUX t0jLun2JzSuuQQ4sNGEv6JimRUGPoVdZbxALZJmGtYycoJtT3GLDUq/d/O0u0CPXsTJy lnSpj/6kZKmfww9JOnP9xI837mBh9HkwsTiv1QYFqeBt8xcMr+IYP8iHlsOAEGeHUuKc zgAHcC/eKBk4s2h+Ku7npr2hInTXBho4CDQ2km8W+PQc4kTx2NcEmMpy8OIEWB66grRM s0+qirI5xQFeiI46C82KKWdoZq62SMFYJqZLqUNiHZoacB2Etm6e5WpN30T8178QfJCv /Opg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=dzwIJZ+AkkNYn86AF0UR4INoEuJdpPjbsWwgaGqqCcg=; fh=tUU3eN15U18LVe9sm1BAQUOV9E0Wtd8b3qdXB3u9Vp8=; b=Lb8FVAc3h+rBr6vySGrjy0CBVj53A3OEqWQJ7q1dLSv8TgLvcqCLUWvJ3NA5MoyJ+k 9XiqZHbEQ0pOE9mdwHHjC2uyB/MHhcavcqvtuYmSWjEs3WBwxEjg7aVUZHKmf8FmBjc+ gi+2amMOn8kCROnK40zgXozFx9NB04s1RkbXz6O+yGgWv0w4eR4unrvGbtk2kXFF6qUm +zkUBAyuuTuAfa5RI0odAptwzeFEzWbPiaKF+D5cdLXCLD2Aci5Hevxf7j/HzedPsIXE OMqrquE4sMSmpXOb4yE3oAdxFzUaEjuwBUNcDXLgovMjrXA22gXzPpkzeKU2ejQJ4GiL 18FQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60827-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCX/lQt/AIgTFIctuesi+PoA5ZvLKuGcQ9cm7hLHJE4rfKzedTax2B0GQtN1Yf1BO5U6msV/rTvTAob9fZb0x3bUXA4qig== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q15-20020ad45caf000000b0068cb37cf647si6575154qvh.313.2024.02.11.07.11.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:11:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60827-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F3AC71C20E7B for ; Sun, 11 Feb 2024 15:11:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08E2F5D745; Sun, 11 Feb 2024 15:10:12 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECF0D5B676 for ; Sun, 11 Feb 2024 15:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664210; cv=none; b=dZ9DLCmYghgY5T2FKpkuUt9Ytfe8s43tAeqfIW3v45EgmjaKENUFU1eXBLc8V68yH6jbQZ9KOdMS//JX6cx/vf5vdV1ibsXO6mIdkgOawGG0xH7k95BqtYoIs1Y8ZNN31c+ZHoobIzvi8UPCoOCinUGs8XLDwvOnmnrrxZlVePQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664210; c=relaxed/simple; bh=CFda6FtgqFCoYpvumAV9E9kesldPM7xLZy26c/iaEys=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=W3VKBJBQp1WQS5y9BWPuqypqD8P3PwHdFc08UOfn+HIaOdwf3vJmrV5zBKRVUEB3WdF54KHQiRcxGd8Qu0gKTpyjL02Dq2mvHW9vgONG/DM2wJjZ9/gEtBjpOJwNzYeTs4JS1/oXcL9pod5V4dTQk2PdYlR8hwwssUU5CQiHEr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: Juergen Gross CC: Daniil Dulov , Boris Ostrovsky , Konrad Rzeszutek Wilk , Stefano Stabellini , Jeremy Fitzhardinge , , , , Subject: [PATCH] swiotlb-xen: remove redundant NULL check Date: Sun, 11 Feb 2024 07:09:58 -0800 Message-ID: <20240211150958.4112-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EXCH-2016-03.aladdin.ru (192.168.1.103) To EXCH-2016-01.aladdin.ru (192.168.1.101) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790615816665364921 X-GMAIL-MSGID: 1790615816665364921 In this case hwdev cannot be NULL, so remove redundant NULL check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: b097186fd29d ("swiotlb-xen: SWIOTLB library for Xen PV guest with PCI passthrough.") Signed-off-by: Daniil Dulov --- drivers/xen/swiotlb-xen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 2b385c1b4a99..b166f6efea26 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -305,7 +305,7 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, if (!ret) return ret; - if (hwdev && hwdev->coherent_dma_mask) + if (hwdev->coherent_dma_mask) dma_mask = hwdev->coherent_dma_mask; /* At this point dma_handle is the dma address, next we are