From patchwork Wed Oct 19 08:31:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp332540wrs; Wed, 19 Oct 2022 06:39:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7svGS1A6hwz9/mHX48D3dfwZVgBw5MPf4TguHzTwULsZeA+Guxebkxm6TgVFdZyBO9QqP5 X-Received: by 2002:a17:902:8c92:b0:178:29d4:600f with SMTP id t18-20020a1709028c9200b0017829d4600fmr8699421plo.40.1666186743482; Wed, 19 Oct 2022 06:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666186743; cv=none; d=google.com; s=arc-20160816; b=XOHjptgJCxNIjz5QE5AbvA9UuzELPftOLqW4525xD4gKkX59VsBouxIABPqPmYMQnP S+54kbFvYTtsmw892s/uQtdUYf/nc6xvIulWNQSecnYF/aHCw0mjdOcOuBSPMdRA4lDT Wsl1yQFg3QbTghbe58nxF4rCmGfCSa7jqdKmEal2kFMvZvRgpqOOxECXsMSJ6axqL3dT CADGP8x7vQ6RXR4VEz37THWJekcbmN3J7lrAdh49XtAENts/Yyp2YpRqpe+Q//tx2qrZ R2Haygk89TAKFH2MRzshTG87BLIN+nfnQGobej/xWhHrCTkuVr6ErLhek8HCCpNGy+f4 rQhw== 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=yf+tDSlpTVcidbbgQZmyb/XNQBli4cxA2NsS6f3z6U/XkSjCslPLSEP98uM/uIzzWk qUPR255P00prVRNsPaXzMO8GviWFrPGPzIqD93ty9DGif+cO0BnNCFNoqOtyqvpL+ERO zdi9ciEARrrc1mn/evWq5YTWFizS0cojxykPp8wE3hn4bo0vQ/6cc+wEeHjC63i4aNzR qGDofItbat2xsFRVX6u5Gr5IwlasZEal5s25Hj/bHMISGkFnTOmnuX8iMQadUy7NA2XK 4RKvkFRO+/yX7RRl5EekPSMSxrB/po7fwWWV3CgQqa1IrHE0hHQc3t4nLvbg8FLqPQX3 XxIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gYkU8cKV; 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 u31-20020a63141f000000b0045a048683e1si18310343pgl.58.2022.10.19.06.38.50; Wed, 19 Oct 2022 06:39:03 -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=gYkU8cKV; 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 S229755AbiJSNf1 (ORCPT + 99 others); Wed, 19 Oct 2022 09:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232993AbiJSNed (ORCPT ); Wed, 19 Oct 2022 09:34:33 -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 442781DB898; Wed, 19 Oct 2022 06:23:47 -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 9BA5DB82470; Wed, 19 Oct 2022 09:03:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D0C4C433C1; Wed, 19 Oct 2022 09:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170238; bh=/HIERa100lh8MOJ+VnEm9GMQEByn7+Vm+HFFy4N/aVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gYkU8cKV9C2WyBw9VlhISJV8LsRwTuKAtA4do4DE8Kh0Ubw4EmUUOLBGcikaU5lo5 Ys3f98mY2cP6YE0EeOYxxP+JicW3Q5KEJvZjvw1gpC+wUvAHxJBmtxwgmJ/6YLo/2c 5nMIQprWEL9s6FlhTSf9NPWwF/9EDK9AQK50voms= 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 6.0 579/862] mfd: sm501: Add check for platform_driver_register() Date: Wed, 19 Oct 2022 10:31:06 +0200 Message-Id: <20221019083315.537366902@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747123430983323869?= X-GMAIL-MSGID: =?utf-8?q?1747123430983323869?= 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); }