From patchwork Sun Apr 30 04:22:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lizhe X-Patchwork-Id: 88900 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1955564vqo; Sat, 29 Apr 2023 21:56:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kzFP2Hvq2zYMVipO8Cv3jUTT6qfPbE4HIcn97BMOQc++2QfYQlUsEQtC6r+9COsUJioTq X-Received: by 2002:a05:6a20:438f:b0:f2:c90a:9e0 with SMTP id i15-20020a056a20438f00b000f2c90a09e0mr11127818pzl.3.1682830591127; Sat, 29 Apr 2023 21:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682830591; cv=none; d=google.com; s=arc-20160816; b=rouAdy05vrJ1XFlSZIF1IjVu3+kPoKPpmtW91jmMjnnGMv8EeOpY0/iUJGNqzRAfMD Fw4s8Zr3Ak9Do0haKl+S0GjMIALqCbROmLGVozIyZTfXBHdgeOXrd9Jpftxq9pAv9qcB gN7tMYgqFKRfCh/mVdlgHLbg58tiVkKg/zGD2dbb2SZ8DB1oOYpHJR0Vx2O3HKjb1R2q xeg/zTq2rEYXTHTs59B7IDXCaMv4tMawBpZhpgU0msen2m0TqoOvZk5a3xpv9/jRkbT9 f8nRCL09DXbzjO3APqHQ1SM6zN8VhGtNBdqNqtNj9k7LapoUvG6NDpshuTR0haa+QzI9 3w/A== 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=qS63VbA9VLHyDMasvm7Ft009tQW4scOgwMZkX8i1AEE=; b=Tc1vdqrboMT/5kBDHYS/frT5HNLO/VaCdxaHHvMFybZLVKUhbXXjNAOgALNa7+Mef9 BlYd6BOuehmMbrTftPwX15ySgpN2kA3UOZMMED2Q1JoFequ746hoduvX0KxOeX6l2knu zngWN6tiNB0iNJdIl80Ju802xmV7GPS6fOZnQzLWLFKtkzmDmhDZEzWQOTFFVCyks8mv g6TKVfumZw/eFFmdRniI98gSWELHZmq2Gc7a6RD68U/A4TEG4eoT+awdnGk4ZPDNub+z A1Qyz1T7qUJd5qRJIrmxz0MqCNzRhGs50WiKRN7xGB6UhAhkmSYp3hW7+DiA31EKtD0e qCig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=AVdCFteF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a63570d000000b0051f110fb97esi23184841pgb.82.2023.04.29.21.56.07; Sat, 29 Apr 2023 21:56:31 -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=@163.com header.s=s110527 header.b=AVdCFteF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbjD3EX6 (ORCPT + 99 others); Sun, 30 Apr 2023 00:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjD3EX4 (ORCPT ); Sun, 30 Apr 2023 00:23:56 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E737312F; Sat, 29 Apr 2023 21:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=qS63V bA9VLHyDMasvm7Ft009tQW4scOgwMZkX8i1AEE=; b=AVdCFteFfFT5oKkJBpaax UvV2HF97t/OntLR67emuqmehv09sCuP6h2Ng1hc5F4GQ76LOdGzqhtoQrjARyOJQ OAAIhQa/WL1TWTAZdrf5g/njT63KuQAgfZYH6wW22okeXUg0LZz8xmn0Uy9pomfx muEC2TnlKwTK3rqavav/I4= Received: from lizhe.. (unknown [120.245.132.239]) by zwqz-smtp-mta-g3-1 (Coremail) with SMTP id _____wCnVFYi7U1kk68oAg--.9220S4; Sun, 30 Apr 2023 12:23:33 +0800 (CST) From: Lizhe To: linus.walleij@linaro.org, orsonzhai@gmail.com, baolin.wang@linux.alibaba.com, zhang.lyra@gmail.com, andriy.shevchenko@linux.intel.com, sensor1010@163.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] pinctrl:sprd: Check if the pinctrl_dev still exists Date: Sun, 30 Apr 2023 12:22:54 +0800 Message-Id: <20230430042254.7543-1-sensor1010@163.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CM-TRANSID: _____wCnVFYi7U1kk68oAg--.9220S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKF13GFW7tw4DCr1rCryrtFb_yoW3ZFg_WF yrGrWxJ3yUGw4Y9w1jkry3ZFW0yF43Xr1SvFnFqFy3C347Xw4UtrykCF45G34xG3s7CryU Gryjq393Ar13AjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRKpBTDUUUUU== X-Originating-IP: [120.245.132.239] X-CM-SenderInfo: 5vhq20jurqiii6rwjhhfrp/1tbiKAhhq17WMwX-sAAAsb X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764575770121606856?= X-GMAIL-MSGID: =?utf-8?q?1764575770121606856?= to check if the pinctrl_dev still exists before calling pinctrl_unregister(). Signed-off-by: Lizhe --- drivers/pinctrl/sprd/pinctrl-sprd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c index ca9659f4e4b1..6f3369130e8a 100644 --- a/drivers/pinctrl/sprd/pinctrl-sprd.c +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c @@ -1115,7 +1115,9 @@ int sprd_pinctrl_remove(struct platform_device *pdev) { struct sprd_pinctrl *sprd_pctl = platform_get_drvdata(pdev); - pinctrl_unregister(sprd_pctl->pctl); + if (sprd_pctl->dev) + pinctrl_unregister(sprd_pctl->pctl); + return 0; } EXPORT_SYMBOL_GPL(sprd_pinctrl_remove);