Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp134623iob; Tue, 17 May 2022 21:25:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn6TirD3IAuVXFjqxXGzPBb+hEsSho/yn2gjHtzT8nvfypOEBDUWa5O4xRGoxqG5e5WLI4 X-Received: by 2002:a63:f003:0:b0:3db:84d3:743d with SMTP id k3-20020a63f003000000b003db84d3743dmr22334714pgh.97.1652847900569; Tue, 17 May 2022 21:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652847900; cv=none; d=google.com; s=arc-20160816; b=0Dl4r3gctALBnI6EVYALCuO4qxL5qD/pbhUVzyN2OXiMo4gWvW3KdjRF+KMiDcfV4R Qd4B4I4Xce6Dny4pMmt0a6g0isv3LyETQtJ0NOxasssEqg3uyWrxpy+xH0AunYmQyxfr j0qB10j/sKaXh+2QLbH51J8leXFyUNSZ1uEA1sVvUDhuuHjlzgbWziDojvozREd3e+o2 7yTOyfjXH4iZZEeSeknVpxUyNT/bi3J4YjSfsocVFYdZZ+Q7+dX+Te/habB+98hU/Igq IlP5QI0PYfomyowiyr/6TlUQnJtyQ39/kT65KXQDfK/J/xeTGfb+5DMDo1CBo7V8X5ml siwA== 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=KHgiralzuwbFYrH+IllvrNWzKpGXUYjClQCXhgMdPIg=; b=JrsBkelcjv9clVVoKmPcvxgU9XXVNf5hqyRMNx6YlPhnmABtcXJ1XIUOJpdji6Diep czKWPjN/d1LzbFYfozgCFKnc/jbSAaZT3i3GNovG1qUJNCvExl9zZ/rwOrHfva9SHtud X9SdRQdA6dsoIO+OpmKcTL7FpaNO5jih2vFnSgRjw6WZp6gsKeI1Bt8pOFjd8B7uOBG1 9f8a546DVNOfyoj+5EWw1BQLGhNS2EKcn10j488R93GBY7LTTmBMlX7dwaxRfDNtuul3 k9+xiMicSpBs2sJy4BEpyW7tS/rpB9DTWt44rxnIWg7WNA5WVlbPOxL6fd/QbqFIFXna KGIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=GKY+T8a7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o15-20020a170902778f00b0015ea8a12fddsi1286960pll.226.2022.05.17.21.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:25:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=GKY+T8a7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B7411A3091; Tue, 17 May 2022 20:48:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352976AbiEQUgh (ORCPT + 99 others); Tue, 17 May 2022 16:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238041AbiEQUgf (ORCPT ); Tue, 17 May 2022 16:36:35 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86CA812D0A for ; Tue, 17 May 2022 13:36:33 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id h85so50163iof.12 for ; Tue, 17 May 2022 13:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KHgiralzuwbFYrH+IllvrNWzKpGXUYjClQCXhgMdPIg=; b=GKY+T8a74JPC5oygV6JYinz0XupyZf5nuPsS8x7/JQJd625CnhFlz9MXvOLFvi73LR i4XQ8WVu2rjVh4w7ftvXu1vazbiAUZTMQvaPPC5baLuUlBqPgUnp8zQck3y79SfoOXwU 1LQxoi9EFlmiVwv/k7YM/V6r+2JqLN8TTm6DA= 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=KHgiralzuwbFYrH+IllvrNWzKpGXUYjClQCXhgMdPIg=; b=t8cOlITvq07L7eyO65SeP2O16oHdioDa+WhrxH1ozix23u6SvYZPcokX0IanIvAU+h 5lSJIod40YxN0tE2nkg0JpMvM9Q6zDHaimM1RxtTgGCN9NeNmNL6uTng6vgIHXTZAt0x TOn10wzcQmE2jVys9PySaGe7HkhnhXxYJl3KErhnqMJmHXT7fd7Tly1jm9LZDbvTurGb 3sUwt8NCcpw3Q6fRCziA7inkH5Con2LNUCkbA4A11qsUhmxCjhuuL1neCz6lm86ndmMc Rv8htaJZRDHveOjaH2wA1Rr5fuHAy985782Ym0m5rIKISua2d6o92A2d+TR6D+0xjPzf S6kw== X-Gm-Message-State: AOAM533XuTrjo8zR2Tic9jYqrz5/Fud6ZgOro/T2J8SwdDE0ZljtD0Gq lHjsjA3qtw1Ih28tpdTbClBIPQ== X-Received: by 2002:a05:6638:1416:b0:32b:c48f:f9f5 with SMTP id k22-20020a056638141600b0032bc48ff9f5mr13053507jad.207.1652819792971; Tue, 17 May 2022 13:36:32 -0700 (PDT) Received: from shuah-tx13.internal ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id h24-20020a0566380f1800b0032b3a7817d6sm17114jas.154.2022.05.17.13.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 13:36:32 -0700 (PDT) From: Shuah Khan To: arnd@arndb.de, gregkh@linuxfoundation.org Cc: Shuah Khan , linux-kernel@vger.kernel.org Subject: [PATCH] misc: alcor_pci: set NULL intfdata and clear pci master Date: Tue, 17 May 2022 14:36:30 -0600 Message-Id: <20220517203630.45232-1-skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 alcor_pci doesn't set driver data to NULL and clear pci master when probe fails. Doesn't clear pci master from remove interface. Clearing pci master is necessary to disable bus mastering and prevent DMAs after driver removal. Fix alcor_pci_probe() to set driver data to NULL and clear pci master from its error path. Fix alcor_pci_remove() to clear pci master. Signed-off-by: Shuah Khan --- drivers/misc/cardreader/alcor_pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c index 3f514d77a843..9080f9f150a2 100644 --- a/drivers/misc/cardreader/alcor_pci.c +++ b/drivers/misc/cardreader/alcor_pci.c @@ -317,12 +317,15 @@ static int alcor_pci_probe(struct pci_dev *pdev, ret = mfd_add_devices(&pdev->dev, priv->id, alcor_pci_cells, ARRAY_SIZE(alcor_pci_cells), NULL, 0, NULL); if (ret < 0) - goto error_release_regions; + goto error_clear_drvdata; alcor_pci_aspm_ctrl(priv, 0); return 0; +error_clear_drvdata: + pci_clear_master(pdev); + pci_set_drvdata(pdev, NULL); error_release_regions: pci_release_regions(pdev); error_free_ida: @@ -343,6 +346,7 @@ static void alcor_pci_remove(struct pci_dev *pdev) ida_free(&alcor_pci_idr, priv->id); pci_release_regions(pdev); + pci_clear_master(pdev); pci_set_drvdata(pdev, NULL); } -- 2.34.1