Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3886338rwi; Sat, 22 Oct 2022 01:33:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6yS+FfgG0yaym3efBglcedHiH+odGf3iR56aOYiiL8Swg/V5AKEyK6tP46mFnMADoAsG4p X-Received: by 2002:a17:903:248b:b0:17d:ea45:d76a with SMTP id p11-20020a170903248b00b0017dea45d76amr23694124plw.97.1666427628774; Sat, 22 Oct 2022 01:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427628; cv=none; d=google.com; s=arc-20160816; b=dtVsi67Cap2CLH+/SySkbwmpkMXMwcfp5KD0lQSdY9sH785mcTw+7R/dzzAsbxf+Mn DN663T4aStFHJVBSx0XPMWWnVcyRithBXKW3TSF21TEjnHgtaOdZl0M6jg9mVfjYNR84 Iq1KdSirmG6RheOC4GdweRU4LpgMDCIxR3LB7w2JjIMPPnvvT9pd5jr/SsMJwGAkm10E mL6LafZxAYXvi5RamIu+2fTCuxpARYrxR6oIEQuAWKIqnBZJqP3CDMUzlaNILrjJX0G7 8olm/ifBcF2PKuBd04V8bSWngP9XLThJgrSgUXjjdmT8tSTnxyE7ifj4uPAnK52pNg6E P3Zw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hUbD7jYnkfK2RLtqHcB1eSo0ORYYYje42e/pQX0r7+0=; b=BXjW5f6qmJU64CMpBLAEsc/ir/nczrA0DSaCFJ2lafxVziGTnrEyWzUPe5d2slTu8u 2NYb8vi+NAg5UxObn5a3jk/IqTYL3D+Qjyce44kvxbitf/VC6wt4OKqMfU2v4M6rUrAA Hx20l7r13f24m75+Um3uFbGXv1UnwKK3d5gcFxta3xFYi8WIchDlnuSHLoa4FWtBm0EA 9SJmr5svDNvLKOzOOq++c4UD/cit+BId6odHi5hbR9gi++EFfmMXaMl0VCqnx8qmMLUJ qISxJyKMBOYkFg59VPkQc7NyBhUsQfxleazY57+ykv0V09BdrBIs63IQcZz0ALNcHLTp qahg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nMxcUVRc; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a170902f60900b0017f73e4af01si11738406plg.298.2022.10.22.01.33.33; Sat, 22 Oct 2022 01:33:48 -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=@linuxfoundation.org header.s=korg header.b=nMxcUVRc; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233407AbiJVIQy (ORCPT + 99 others); Sat, 22 Oct 2022 04:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233688AbiJVIOv (ORCPT ); Sat, 22 Oct 2022 04:14:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F719290E1D; Sat, 22 Oct 2022 00:55:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CB7F5B82DF2; Sat, 22 Oct 2022 07:55:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32472C433D6; Sat, 22 Oct 2022 07:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425344; bh=/HIERa100lh8MOJ+VnEm9GMQEByn7+Vm+HFFy4N/aVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMxcUVRckV7hwBPYPE1F/9kS4ZlwYkEf5WRYgBQld3bJLftlQkLr63snN6mP9anSb f3fBX+zDuVyKCgbGEJvGsB5ECvQayt4IWBX17QOMg2p7442IvU+090zKvezEtafsuJ Sqttzz9s2myf8bhrwh0sIVBj59w6tP/Hg89jEY+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Lee Jones , Sasha Levin Subject: [PATCH 5.19 471/717] mfd: sm501: Add check for platform_driver_register() Date: Sat, 22 Oct 2022 09:25:50 +0200 Message-Id: <20221022072519.163507867@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Jiasheng Jiang [ Upstream commit 8325a6c24ad78b8c1acc3c42b098ee24105d68e5 ] As platform_driver_register() can return error numbers, it should be better to check platform_driver_register() and deal with the exception. Fixes: b6d6454fdb66 ("[PATCH] mfd: SM501 core driver") Signed-off-by: Jiasheng Jiang Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220913091112.1739138-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin --- drivers/mfd/sm501.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index bc0a2c38653e..3ac4508a6742 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1720,7 +1720,12 @@ static struct platform_driver sm501_plat_driver = { static int __init sm501_base_init(void) { - platform_driver_register(&sm501_plat_driver); + int ret; + + ret = platform_driver_register(&sm501_plat_driver); + if (ret < 0) + return ret; + return pci_register_driver(&sm501_pci_driver); } -- 2.35.1