From patchwork Sat Oct 22 07:25:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104854wrr; Sat, 22 Oct 2022 01:33:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xcBw3LpW70gIpwLC/wh0PNkcWzNd+6+Y3BNDvgmwCbKrVSZCy9yqLdr0KjqVPfdqRnybl X-Received: by 2002:a17:90b:3850:b0:20d:54f2:a780 with SMTP id nl16-20020a17090b385000b0020d54f2a780mr62461228pjb.115.1666427601350; Sat, 22 Oct 2022 01:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427601; cv=none; d=google.com; s=arc-20160816; b=uSjxvqmJsCHQShNyvr2Z7qDrzQn307XJhWV+6qdCc+p1hnDRero5oSkRPzcQMHzJvm jEZcK1aNawnfkoz9ldYNTTNS5UMYNEoeI7fOBh9ncxF5cjd5/pExB3/q3mFQUB68u1Z1 CsiI2whrkeb/Z7jfL74GpCEaJZBhykTMJBO2jeQGrrjQOYZYNpjcHk3Lo0J2O0+HZD3E GLWIvgMyKV24IqLrAiaJ88tvTnH3K5qI1e9tURGrjxpF2C7UxkI2bh//dItpHhxOa6OY 9ivqhGtAFlD4dWlwk5G4pqiOIf4hOUYIssssu1IcC6h4eQRCZUY+XqWRDGUHx/lpIt75 lhkw== 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 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.05; Sat, 22 Oct 2022 01:33:21 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747375988115128501?= X-GMAIL-MSGID: =?utf-8?q?1747375988115128501?= 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); }