From patchwork Fri Jun 9 10:49:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13273701 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6031CC7EE37 for ; Fri, 9 Jun 2023 10:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231266AbjFIKuI (ORCPT ); Fri, 9 Jun 2023 06:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238778AbjFIKtm (ORCPT ); Fri, 9 Jun 2023 06:49:42 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86D4A132 for ; Fri, 9 Jun 2023 03:49:41 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-30ad8f33f1aso1137446f8f.0 for ; Fri, 09 Jun 2023 03:49:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686307780; x=1688899780; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=o7/b4G181+MHQIHp41//nlSYfR9ybEGflBKyQZuJUvw=; b=V5O8iujnQNkhCcIam1hTZkf+ZLG2/2Ubirq7lBYinzScSuNUsh1dWn64nlXwtR7/1Q ue+EfikKQnH35ogS/vMaGpOvcZxrmy3n+1/148N34kWMVX/W3OUXAaiPFocedngTr2lX aNFzcyuSEzk2LCKpXyHdZE1fCfh7HklYpwyaY9yIGU2Y02ydW6CNuxMRpq1gwt6T5TZE WCUFxegwcA77j91SEspEM3DxkkFM4+jT/QDNvnKwyuonr3leTfvyBS/l9rfXKg4lRCfv xNLELT0Tb3T9y+dIeKYd0FPMKUDO0phi6anlM5LYwuiF9QQW+LfLtazVvpAcCnT/+iON 1yLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686307780; x=1688899780; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=o7/b4G181+MHQIHp41//nlSYfR9ybEGflBKyQZuJUvw=; b=jA4GcdN+PEGoctu/3GhEKVDCHLfk60HA1S3lujhbwHiGjI9ljmvI+SSjy0CyCticna XMBVynsFiOdHTFCQzodv+mJV0kZuzh/f9zRuLXPN18xrrsPZXilhpGeHYiQiIGc1NqRB Zb7yZMzUMDA4YCU3pTHQfEhC8ROrbwlqqqgwdRcPACeCaT6ptKDKbDumJHaggBthWlJo VMplydNomr8gpAG1OMD7+ojuZ47C0LlfAwU+gt26kUNqCfHsS9KmHRWUiIaM/bhDvOmR 5rnK26GqZutqJtzgbNanitcYi+8wMJ6UKmZicLMBVX/ZMZ8fiUIY448Ze1KCLJggY3eJ ny8A== X-Gm-Message-State: AC+VfDwSWHV/XtwYmzx0ac8Al3qfs8dHR8jWR6gQRfwz/7faj+PTsQmB tt+707Q0DiSnEsQR2vjnj4pDGw== X-Google-Smtp-Source: ACHHUZ5oqsdm6RcHcYynLSUxXU+NRtZqKnXmXX7d4X/lAxBhMjxzqQTGHG36+5LbULIK1GqQozrfaA== X-Received: by 2002:a5d:4ac7:0:b0:30a:e643:2517 with SMTP id y7-20020a5d4ac7000000b0030ae6432517mr574141wrs.21.1686307780049; Fri, 09 Jun 2023 03:49:40 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id k17-20020a5d4291000000b003047ea78b42sm4127545wrq.43.2023.06.09.03.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 03:49:38 -0700 (PDT) Date: Fri, 9 Jun 2023 13:49:33 +0300 From: Dan Carpenter To: Manivannan Sadhasivam Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?q?Wilczy?= =?utf-8?q?=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Damien Le Moal , mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] PCI: endpoint: Check correct variable in __pci_epf_mhi_alloc_map() Message-ID: <258e8de1-abff-4024-89e0-1c8df761d790@moroto.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This was intended to check "*vaddr" instead of "vaddr" (without an asterisk). Fixes: 7db424a84d96 ("PCI: endpoint: Add PCI Endpoint function driver for MHI bus") Signed-off-by: Dan Carpenter Reviewed-by: Manivannan Sadhasivam --- drivers/pci/endpoint/functions/pci-epf-mhi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c index 1227f059ea12..e7d64b9d12ff 100644 --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c @@ -112,7 +112,7 @@ static int __pci_epf_mhi_alloc_map(struct mhi_ep_cntrl *mhi_cntrl, u64 pci_addr, int ret; *vaddr = pci_epc_mem_alloc_addr(epc, paddr, size + offset); - if (!vaddr) + if (!*vaddr) return -ENOMEM; ret = pci_epc_map_addr(epc, epf->func_no, epf->vfunc_no, *paddr, From patchwork Fri Jun 9 10:50:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13273702 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9861AC7EE43 for ; Fri, 9 Jun 2023 10:50:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238387AbjFIKuS (ORCPT ); Fri, 9 Jun 2023 06:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238708AbjFIKuR (ORCPT ); Fri, 9 Jun 2023 06:50:17 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0A6CC3 for ; Fri, 9 Jun 2023 03:50:15 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-30aebe2602fso1244127f8f.3 for ; Fri, 09 Jun 2023 03:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686307814; x=1688899814; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=LwQRa4qckO6ixQp2fV7L1BkurPOrWgrccG+//fvOGOk=; b=mdTwXfnjJwYxsIMkqgCh9ivyXno/zU9hfPaJmMw1GbPJojTGdYSAPn04sqfxupAd+U WTYkSF275EtRIZn55DQSQSWY/Rqdc2cqlvDVLwmy9bmMZlMfOJSz8ksPwiO9IGntduYU lSCh204kh3bF1mhohGHgn4dPZvZMEL/M4QDxoQQjTxQaji8dNPBSomMInPl3RRh7qPR6 chJJqoY1ac/pTuQJFkOJyxRpX+PRnqKl4yiSuEf2cBIBOKEBRHY2uCvuDT1PrxEPCIoI JRqtTeYk3uT1CNyEogV/3gGKDkPJkSYBSEMKUBucXoQ9Dv/d7yX57h15ekqo+O4snjzm 7HEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686307814; x=1688899814; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LwQRa4qckO6ixQp2fV7L1BkurPOrWgrccG+//fvOGOk=; b=cTsT6IlLJ9j6aCr8+w8mrCtc2m9jYtajsnx8qcXB3sMnTh9AsxrRhIvXZqF9DNfe8o otghew1lbV9JRFa0tkjhAW8VH9ARIsQXT9lZVUwuDp1BtBRffaqXFk/Q8OMwWQHtH32J 3kqVi9hZvq5fM0n4M8ZBwUDSRwTDtzUHPXwEZQSrqLPdca8qcBCvawAvIBWr6db8EtB+ NF5uf/FFFvTr+oqz4g20MmJ+C6SSaB2sNUitDf8HtWEaABuTy00r9TkbsWNe9umv1Auc Wta9cYLVv5yckPMBsN8agIh2/bDyz08iqoj+bjAOKPmC2ZMA14uf+ElWKhvkXknj4wWi NUlw== X-Gm-Message-State: AC+VfDyQfzX3+tmp1vgXA2u3MrGeVfi/XSHn6Q2ABYwpf02Iognkn8xU V4GAeXtE4hTviwniF//aMt3I9R4GT/3nZIWE6fM= X-Google-Smtp-Source: ACHHUZ7XJbN2Co07oOsfu9qDjkJ8aZ29vciyT48xUtdRs6Y+sT9fXC3xbCouvmEQAGoTnxZypxLhhQ== X-Received: by 2002:a05:6000:1012:b0:306:37bf:ca5a with SMTP id a18-20020a056000101200b0030637bfca5amr732641wrx.47.1686307814208; Fri, 09 Jun 2023 03:50:14 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id m6-20020a5d6246000000b0030e52d4c1bcsm4161556wrv.71.2023.06.09.03.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 03:50:13 -0700 (PDT) Date: Fri, 9 Jun 2023 13:50:09 +0300 From: Dan Carpenter To: Manivannan Sadhasivam Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?q?Wilczy?= =?utf-8?q?=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Damien Le Moal , mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] PCI: endpoint: Fix an IS_ERR() vs NULL bug Message-ID: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <258e8de1-abff-4024-89e0-1c8df761d790@moroto.mountain> X-Mailer: git-send-email haha only kidding Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The ioremap() function does not return error pointers, it returns NULL on error. Fixes: 7db424a84d96 ("PCI: endpoint: Add PCI Endpoint function driver for MHI bus") Signed-off-by: Dan Carpenter Reviewed-by: Manivannan Sadhasivam --- drivers/pci/endpoint/functions/pci-epf-mhi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c index e7d64b9d12ff..b45db923306b 100644 --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c @@ -354,8 +354,8 @@ static int pci_epf_mhi_bind(struct pci_epf *epf) epf_mhi->mmio_size = resource_size(res); epf_mhi->mmio = ioremap(epf_mhi->mmio_phys, epf_mhi->mmio_size); - if (IS_ERR(epf_mhi->mmio)) - return PTR_ERR(epf_mhi->mmio); + if (!epf_mhi->mmio) + return -ENOMEM; ret = platform_get_irq_byname(pdev, "doorbell"); if (ret < 0) {