Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48C87C433E1 for ; Wed, 22 Jul 2020 10:00:32 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 103EE2065E for ; Wed, 22 Jul 2020 10:00:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="StpgctWC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EBSseY2c" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 103EE2065E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ydw4SOV6zysQbfoz1EwY0A1MhVGXa3ONms4l/ip/nwE=; b=StpgctWCEUlsZkX0ag4yG0N8i 0fHnsqVI217QK9oNrwPPAFM5OjJFsVUilcCO+qCuV3fH4EAYEdyshW/zCaWJ2IxPEgpTdAVvlGuCY O0D+IPHSe2pnP1Kg9NaBJp/yjCkzxgVA8P1DlTsFbq1+IlgDJKcnS4hUX09IddhhUEJZz1vMuNBGc aow9OGXQEM4QW1YyJL0D4lCDNCNgUnLSGu3Vb6cI2vuz5DKagfjlMseErvIPp9idY8U9iNZAnqt0f JxkFnFvvXGe5AoruhzQ/qog6WKkaxLmMgn465+3uNnb7FFDBgG0xUwm8YyFys7d57aTcdWZ/vKxeL mWYYiEIfQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyBWB-00082K-Cq; Wed, 22 Jul 2020 09:58:31 +0000 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120] helo=us-smtp-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyBVo-0007vl-8G for linux-arm-kernel@lists.infradead.org; Wed, 22 Jul 2020 09:58:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595411887; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mu4L8Prz8Ruqp2HUMJmhWFmCnK7ZVX+9Vi1KI78VmIA=; b=EBSseY2cwGJl6bHv4D55D++lbvCG+tWZUWGrRGUdJ5x6zilD9ysnj1gwa0Jr4F5/WWA+Zi tNBChHgc4Bzl66zjt89/pcUhRNn+pnTaFZL4OsqLvmWHBokhGvV55/fdXHR6DWFl7WpNid ide5AvlXsfTxQtqEEa12tCRLfgNDMz0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-13-n0uS_jQXPgiR7GjCSW7hTA-1; Wed, 22 Jul 2020 05:58:04 -0400 X-MC-Unique: n0uS_jQXPgiR7GjCSW7hTA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED732800C64; Wed, 22 Jul 2020 09:58:02 +0000 (UTC) Received: from localhost.localdomain.com (vpn2-54-170.bne.redhat.com [10.64.54.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91E935D9CA; Wed, 22 Jul 2020 09:58:00 +0000 (UTC) From: Gavin Shan To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 05/17] drivers/firmware/sdei: Unregister driver on error in sdei_init() Date: Wed, 22 Jul 2020 19:57:28 +1000 Message-Id: <20200722095740.28560-6-gshan@redhat.com> In-Reply-To: <20200722095740.28560-1-gshan@redhat.com> References: <20200722095740.28560-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=gshan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200722_055808_395977_8EF474A1 X-CRM114-Status: GOOD ( 11.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, will@kernel.org, james.morse@arm.com, shan.gavin@gmail.com, catalin.marinas@arm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The platform driver needs to be unregistered on error to create the platform device, so that the state is restored to original one. Besides, the errno (@ret) should be updated acccording in that case. Signed-off-by: Gavin Shan --- v2: Derived from "drivers/firmware/sdei: Rework sdei_init()" Unregister platform driver instead of platform device Remove duplicate ACPI enablement checker Update errno (@ret) accordingly --- drivers/firmware/arm_sdei.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c index c9f2bedfb6b5..909f27abf8a7 100644 --- a/drivers/firmware/arm_sdei.c +++ b/drivers/firmware/arm_sdei.c @@ -1090,9 +1090,12 @@ static int __init sdei_init(void) pdev = platform_device_register_simple(sdei_driver.driver.name, 0, NULL, 0); - if (IS_ERR(pdev)) - pr_info("Failed to register ACPI:SDEI platform device %ld\n", - PTR_ERR(pdev)); + if (IS_ERR(pdev)) { + ret = PTR_ERR(pdev); + platform_driver_unregister(&sdei_driver); + pr_info("Failed to register ACPI:SDEI platform device %d\n", + ret); + } return ret; } -- 2.23.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel