From patchwork Mon Oct 24 11:30:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481422wru; Mon, 24 Oct 2022 07:23:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fIHXbRFz4CRLPogofav/L7Bw0kGjtZsp6XShcw7puCkSfuPC3sTv1m4aBqJr1ATpE/m19 X-Received: by 2002:a05:6402:249f:b0:453:eb1b:1f8b with SMTP id q31-20020a056402249f00b00453eb1b1f8bmr30312348eda.235.1666621385678; Mon, 24 Oct 2022 07:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621385; cv=none; d=google.com; s=arc-20160816; b=WyAYe+mwr9E2K62cdhl7JHGjCC4VFOkGH80/nzikqKPs8WI6aQPHGFJTv9qMhsncaK D4hwRCgz1Fcp6tYMmqg3VC0jRHQV9ttmaTwv39iX5uBt5tCIsd6EgVAs8LQ+24rmPIsr MRpXB+6EQYqHquLOlny+Ip9s7+3OubWT7TzDsPP/kqWqwNcYYkrpW1DfY0MsGyFnVVja vGbYuLlVZadC/tXQyyzPGm/60qRrpRSHpOeGsh0qwyDjmePC+bD891fF6mdSeF9IdBzt V0VpTfADwTBkDwEsa7tP40oTW8Z9JBnGyJnR+kGL8qNzCUKL4lGx0JwL3V/XJxA1IMJM VdqA== 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=iOCeD4IXS5rlA8uzhJN9dldiydkSKe8YbRk1KZhGZ/4=; b=loZUUwEyU5yyXX92y93wYFLYIAEDdeOyHvNMoE3BW1Sjuu/BWVuUTJNgrQqZBVicuH gGv+17KD/pIsx3Mo+RfAEJclJKjzq/P7Zn2yansMfKKjCONX2qgSfAN1faA8Ef3ynv1D EnMWFkEp4OcBo+AYPElqKxMP1X/QHd9mJ6DsVU7Ih58euFVNJUuAjwtLT33DGAt01XNg bU52a1ehdQQTTObzD3VfJMbUTMH3HUS/ZgW1lNCOR7T8Ss6VUh7U9ErWWjp6/+u0i0Mg Oe7zz+bEbfuEY/ATcoY2zAyea14bOKW+dboNcBtR283sCL9IOmGMkfDRr2x2MBmyQMzx 4JnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CeASMxgY; 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 hz6-20020a1709072ce600b00791a67e4c04si15158469ejc.31.2022.10.24.07.22.40; Mon, 24 Oct 2022 07:23:05 -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=CeASMxgY; 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 S235462AbiJXOVM (ORCPT + 99 others); Mon, 24 Oct 2022 10:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237053AbiJXOPn (ORCPT ); Mon, 24 Oct 2022 10:15:43 -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 47AF977EBC; Mon, 24 Oct 2022 05:55:34 -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 DEE04B8168C; Mon, 24 Oct 2022 12:27:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CC54C433D7; Mon, 24 Oct 2022 12:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614460; bh=LlDjGU1z6C8Y/HGgUIA6xrtbjnFjPgP22JBVHE1fZJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CeASMxgYBVxU1JGBOoCyRCDxDnPfGSFKO/JOJmw/aVy7NCwCWHAg1iWhAB8SddyV4 84nJHs1X/6aM3eG5L8N4vQjqF5f9zYsS7Ts+h/ERc55aYfyetYzZXks3BJdZ2iy3iG Xzzw5PMPkoTeiwNssJKqraW6m9mklAxVc7bhwiIw= 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.10 252/390] mfd: sm501: Add check for platform_driver_register() Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024113033.596128064@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747579185812740603?= X-GMAIL-MSGID: =?utf-8?q?1747579185812740603?= 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 6d2f4a0a901d..37ad72d8cde2 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); }