From patchwork Mon Oct 24 11:31:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640828wru; Mon, 24 Oct 2022 13:33:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7RqtNc/r66jRYyRTS7N9xbseq3SCI9V5gQncB2XEGoHqX0MEpjWcD4cL2olcXQCUR8WXpU X-Received: by 2002:a05:6a00:4c8e:b0:562:a157:6599 with SMTP id eb14-20020a056a004c8e00b00562a1576599mr35165582pfb.59.1666643619396; Mon, 24 Oct 2022 13:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643619; cv=none; d=google.com; s=arc-20160816; b=S03VSQrfSFjJSW1agGwQ1elfZMAZT5ILJOCnmPlhI8/osWMN4R9cIIcAQOJVC/DHm/ MlvoralgA7GZ3PsjVHYKkqqoBFRJIeHVkvZ1YgWpsTqKTkcfEB83+NPXLgc26Sa71VM1 D2iCEutfn0M1rg/Sh8lnSl1/lE5UuvQOnE28LBWH2xkF/H3NSLFDqqRaaWp31w6pJKQW PiOoFm4oq+q0MuEYUR6T+LDVzEKkn7LGpZdFqDPKXvs0YdmF4/ycRXGIszA4JMZXHncF 29MMveYaCUM0KUhI6fon36XVncTg5WMiI8L4aIXzS/4orHckKkb8bnuthWRsm5H3gc/H ETRA== 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=HES3aUMc7j86bPcRiouBQUa+Jx+PgWmCfI5TEXfEYSo=; b=YVdYPn7kxeiHOIE9l5Mr7HRVk0amMccKJyfYV5qA+U4aOtoIgIlBbzyi5EHjlvzMzE j8HvNTMwlGxzfHP/lemFpT/S8lZlsgJjzq0I6BTm6winEsj/9Dxzslc1oRxaWaUSzW72 a8DfvcPjAH5ir/CZWNKh/b0TdC0jBtwDko+kmtfHm9oXfOs5jJXZGDTdmGK+lKtN4o/9 HPbi1D9o1Mchlfc6kafZ9Nr24do+BbhEl+Eu/E5buVfRY8lMrAoStKsDRrCtw1sjuqO6 8OzxJ1hqio70SHbBUh3U2dT6+ThsZAszKojkEX6uTYRPV9Sw7RqxwGJ0I4kuEAmkPWwn P9RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oRXVU11G; 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 i66-20020a626d45000000b0056bce3dfaacsi695086pfc.25.2022.10.24.13.33.26; Mon, 24 Oct 2022 13:33:39 -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=oRXVU11G; 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 S231764AbiJXUVV (ORCPT + 99 others); Mon, 24 Oct 2022 16:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234175AbiJXUUw (ORCPT ); Mon, 24 Oct 2022 16:20:52 -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 4091E1217C6; Mon, 24 Oct 2022 11:37:20 -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 8F81BB81600; Mon, 24 Oct 2022 12:13:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7523C433C1; Mon, 24 Oct 2022 12:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613584; bh=gz9ev0LdS7M3V9dBmwprZdmuld09/+jN/6jhqDDKq8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oRXVU11GhZeHR0SnDiQqgBA38RhXibqWcQ2YdsOpq5f7PD8SAnXCdpJm/8tiDDMDS 8w8mluCX6En7DuULcuDwVHOZ+0wH8AVKFHRyKmNxXlHeVoKJtj1tw3gmf1VDZ6qjoL 4faCGF2uVW0t1vR2pXf70uyP7HUzzYHvJQGI7FXs= 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.4 162/255] mfd: sm501: Add check for platform_driver_register() Date: Mon, 24 Oct 2022 13:31:12 +0200 Message-Id: <20221024113008.082171119@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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=unavailable 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?1747602500299069598?= X-GMAIL-MSGID: =?utf-8?q?1747602500299069598?= 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 bbcde58e2a11..aab8d8910319 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1733,7 +1733,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); }