Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3424923pxb; Mon, 4 Apr 2022 16:35:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwufmroXrzHfjs2Rwy6+TRoBUPeRsOKCmS28QTox5c1/6SAY7Dt9iEMjl6Itk3ro6Xb67H9 X-Received: by 2002:a63:4a25:0:b0:382:2f93:546a with SMTP id x37-20020a634a25000000b003822f93546amr516566pga.116.1649115315901; Mon, 04 Apr 2022 16:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649115315; cv=none; d=google.com; s=arc-20160816; b=JotYIA6w/OpEbWNW0BgwCVavhuUQzXKkKj+1gMQ7BHqYoettQVS4Tbx3SfK/eIATwh RE4qQYdUTilC9xRVfsPcS0o5nKBwk/lCyvjeA4Nw+LWJkfJscQuOI/4hEcXOsTdIlPqH 2uOe1FzyPNSTebY8t3v7iV59D3JMozfYw8oNdgICU6GGou/29ssfLRfX2zJPYA4gEWGK sd4KNUgMoPwHgQDSoqM+rUhruHz0P0oI0ieZfz1kMSKkDPSlprCFxxBohO8xShLB/obo Q0LXvEtU0qelJVPCqi2yiGMpJbUKhG46Q7xWvx/wzEVcc8n3ImbDwABN83jp7XOCrT58 SgcQ== 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=BVxMHUicLbUH3Hvb1PPfVYvYyoskkvyv49vbgbrFCNo=; b=wU6+Uy3tHqyBT5iONQ+86Le0ABSQWFzpiEpVm6Z9JVAd0NbffuvuJbCk2iW5O3DGfq Y0cpiaIH+vqjj3zUJUhcsjBtExMVT7vDTV4Y/vEh49Nm6T2g4KwUYBxY9U8RNMFaU5AZ Gbv6Bd79YkWYBut4hoip97JsX6WMJBuSOwoIOs3sMwqj1L5aAGpUpFh2x8mmVYMeTdaz GlsCwwud5VoJ5QJ7vfpDkODCYgnYbTP6WL3r0g/ycW9DeBm02VKEuVKFxB8nLeQSW0FO /p/29VCejaqxb4P8ENEaA0wZ+UlfXS/iAw7TsuscSdXUpSuqtafFOMNBKgT7f+rHqeYt kyaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l4c6G01X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h6-20020aa796c6000000b004fa3a8e006fsi10937167pfq.294.2022.04.04.16.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:35:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l4c6G01X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D5C138BE0; Mon, 4 Apr 2022 16:29:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244631AbiDBR64 (ORCPT + 99 others); Sat, 2 Apr 2022 13:58:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231678AbiDBR6y (ORCPT ); Sat, 2 Apr 2022 13:58:54 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1118F13F8DF; Sat, 2 Apr 2022 10:57:02 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id o10so12085423ejd.1; Sat, 02 Apr 2022 10:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BVxMHUicLbUH3Hvb1PPfVYvYyoskkvyv49vbgbrFCNo=; b=l4c6G01X/mM7+1GnZ7oTuCLmtLgPbKG3mx7SbFPIku+ccwGTElZ0p+W8JpJcckG2wh /lF6CkMeckAATTx3qq8eCxC0mdDSJ0VT019mKzu8JOetLhqQuR09W5RVyrR1UzGEDt7H knZw+WaqR0Sidvgu5QJrnqYYMGo1Y1pb08ICafpgzDjkd/Q6yIWrf7dgseR/JD945Em3 9BH+Nb3SU6TlJBW8YtlSz/fuKkv3a9zHjIUAn2x7LKtTPE+BqSFW9l9bishHF4Eei2fe fJhs+n3r7vBmF7oQn92ysEu3AeNjnZ7OlVofn2YH8295+lgWegZ90Ap6GMNXlUY+LxGh c2sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BVxMHUicLbUH3Hvb1PPfVYvYyoskkvyv49vbgbrFCNo=; b=ZuGYeZYiUHLKCbhIkK2JhN9wQNBD40VMaoOofC50oIHn7kYCkc881k+M7Py3RDJFJ4 Kh6tBCrOwcq9zdX9Guk2zcTDwbdiPIl1nRx9zkYQU1VGdo+3L9eTE/KhzfcqPSVML78Z 8ot3ZdXNP0TSjnAeBgj2YPlY0U6u66AmgW2Le8cpzkF/dShMMQ+CLSQG+5j4s6+fE+A3 PYLIzXewKj2eGwhP4/MNobn3DkQsLOe8FHeEDXHVbzvPiAIIYIYJHnKfdx//a+/AIPHN 1eaobQKP++AzLBzK+S1ZGwjBgBBOLKwu8m4Z4npHE7pAhdPRP25lBj8UX/+OpHfQLMDW lYCw== X-Gm-Message-State: AOAM530lOyga1/NAwu8ATbOnwbtK1hkNVGfdOJ6Z5Dxmae/L+J4ceUBT V8TYlidUsJOS7SYgxmB7rOc= X-Received: by 2002:a17:907:62a9:b0:6da:7953:4df0 with SMTP id nd41-20020a17090762a900b006da79534df0mr4472210ejc.316.1648922220505; Sat, 02 Apr 2022 10:57:00 -0700 (PDT) Received: from localhost.localdomain (host-95-249-145-232.retail.telecomitalia.it. [95.249.145.232]) by smtp.gmail.com with ESMTPSA id hs12-20020a1709073e8c00b006dfd7dee980sm2330857ejc.30.2022.04.02.10.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Apr 2022 10:56:59 -0700 (PDT) From: "Fabio M. De Francesco" To: Sudip Mukherjee , Teddy Wang , Greg Kroah-Hartman , linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy@lists.linux.dev Cc: "Fabio M. De Francesco" Subject: [PATCH] staging: sm750fb: Call iounmap() to free mapped bus memory Date: Sat, 2 Apr 2022 19:56:55 +0200 Message-Id: <20220402175655.31512-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 If ioremap_wc() fails, the code jumps to the "exit" label and forgets to free the bus memory mapped into "sm750_dev->pvReg". Mapped bus memory must always be freed by calling iounmap(). Call iounmap(sm750_dev->pvReg) when the above-mentioned failures happen. The site of the missing iounmap() has been detected by Smatch. Signed-off-by: Fabio M. De Francesco --- drivers/staging/sm750fb/sm750_hw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c index a7c6eb07b62e..55cb00e8b0d1 100644 --- a/drivers/staging/sm750fb/sm750_hw.c +++ b/drivers/staging/sm750fb/sm750_hw.c @@ -81,6 +81,7 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev) sm750_dev->pvMem = ioremap_wc(sm750_dev->vidmem_start, sm750_dev->vidmem_size); if (!sm750_dev->pvMem) { + iounmap(sm750_dev->pvReg); pr_err("Map video memory failed\n"); ret = -EFAULT; goto exit; -- 2.34.1