Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1468127rwd; Thu, 8 Jun 2023 19:24:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4m5qevy27qgDvx47sisydzG4TSBExoJ+PHd1iYQN2BXFJTZI6fXqvAVWWD0HlP1UeMLP1U X-Received: by 2002:a05:6a00:1590:b0:661:182d:3495 with SMTP id u16-20020a056a00159000b00661182d3495mr21503pfk.13.1686277448726; Thu, 08 Jun 2023 19:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686277448; cv=none; d=google.com; s=arc-20160816; b=FiIe1kf8vdsge/Z5cv2LeCvqbVsskfSp5wN8tJQz9oWZVgWI2/etRPgexXRyZNen1L 1h1o1xOIdnPLlqPLnh9TfuZSoInZRtxgnkkNhfsGXF6dXu+FGAFw3kDuJY7hBOmCFR7+ f8KMBbF9fdP3FyDOawyuDg0nuTkJ8w2wP8so0NDlYitX5uXOcwsBmcoSncjrr8tJRiAn VdSdQozEjHzojG8Qo/fbwhB17cN4npOzqjI8ebsxiHvl+W7eQr20RbgzfUy3kctDKwIF qlsmlbCdt/aL/vb5CAUkKfYMltsj+pmY+IWRoPWMenmXJSB7abnxnlaCS8nTiaDGtpOH qnnA== 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; bh=OAQgWbIeeg+D8FESkMXmqOJaZwehlrZDYYGjXi7Fvlg=; b=cz4SMVIj9BfJ/VuSWApBVVUbMJNNfaWJwnGHxDqhsOP2/xUkdyKxpdEh6bQa+23lRp YlQ2AjbYqHf1ro2B1wIAeuSwk139t+lMvl460URJQMJ48s2p5Pim/00PRr91UAX7rpUU VpXtkCwU3AqdXCeNHEVlrcdzAJFyCiOUUJhGsmawVXVl5PeYMmTGW7Q53/cYi+NxRd/e rHaR7nzwMkIEazK04f6hFYwyhSLw2lanABLykgd7+Jiqup8OCFCcFewTxB3Ry/lrPH1Z 95DOHwqx0hyAqRrQkOKsFKimBeD07jEs2UEb8y7g9g7LF7QHHXvIlspouzIqt+ZYhIgo RG4A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a18-20020aa78e92000000b0064d2d6b6b87si1705483pfr.268.2023.06.08.19.23.55; Thu, 08 Jun 2023 19:24:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237957AbjFIBs1 (ORCPT + 99 others); Thu, 8 Jun 2023 21:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbjFIBs0 (ORCPT ); Thu, 8 Jun 2023 21:48:26 -0400 Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919A11BF0 for ; Thu, 8 Jun 2023 18:48:24 -0700 (PDT) Received: from ed3e173716be.home.arpa (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowAA3PS3jhIJk1ID8DQ--.1207S2; Fri, 09 Jun 2023 09:48:20 +0800 (CST) From: Jiasheng Jiang To: lee@kernel.org Cc: linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH v2] mfd: intel-lpss: Add missing check for platform_get_resource Date: Fri, 9 Jun 2023 09:48:18 +0800 Message-Id: <20230609014818.28475-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowAA3PS3jhIJk1ID8DQ--.1207S2 X-Coremail-Antispam: 1UD129KBjvdXoW7JryxWw48Ar18KrWkCw1kGrg_yoWfXwc_Ga n5Z3WfXrWSkrs5Kw1Iqrya9ryFkwn2grW8WaySyFWSyryUXryUWryUuF4rAw17ua4q9F9r G34DXr43CF1ayjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbwAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJV WxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1l42xK82IYc2Ij64vI r41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1Y6r17MIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E 14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x0JUywZ7UUUUU= X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 Add the missing check for platform_get_resource and return error if it fails. Fixes: 4b45efe85263 ("mfd: Add support for Intel Sunrisepoint LPSS devices") Signed-off-by: Jiasheng Jiang --- Changelog: v1 -> v2: 1. Replace "-ENOMEM" with "-ENODEV". --- drivers/mfd/intel-lpss-acpi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c index a143c8dca2d9..212818aef93e 100644 --- a/drivers/mfd/intel-lpss-acpi.c +++ b/drivers/mfd/intel-lpss-acpi.c @@ -183,6 +183,9 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev) return -ENOMEM; info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!info->mem) + return -ENODEV; + info->irq = platform_get_irq(pdev, 0); ret = intel_lpss_probe(&pdev->dev, info); -- 2.25.1