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: 8793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430831wru; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6D6my+G/cZoeD1MXHAzfcURwJa3XoRl+nvBDAcfIdajyyriE4rloZModlRHqSyprGSkq78 X-Received: by 2002:a62:7b0f:0:b0:56b:e472:9e81 with SMTP id w15-20020a627b0f000000b0056be4729e81mr3490936pfc.13.1666615340671; Mon, 24 Oct 2022 05:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615340; cv=none; d=google.com; s=arc-20160816; b=nfYW/LSWWZRnkA/x8QdPdQvnOfiTNe+kF+Z0sCd5vBSCAXV6S7QDJ64AZxFVUx/Usx 1f6HKQkeOK81GqMWR5T07rWqjfIR5N13mHxzuFpaIZqufO7khzdhcD816BrE5Lo41P7+ O5vOLNLh4H2sV0zxekjF8gGdGC8+j5ExsEHtL/iCNC2ZsRLkFYzClHUC+lkN4RTrxV5/ mOSMp1GeNGKQcSjj2B30yLlZz7SLlS7BrpHv8OSSBsrm6h65w8LhthrMhiWzi6xz9V55 /XgEPP4cOIBZ5//j8A0IkVgTkrEgKIvq3c21pZ3oYjDyy4jxfFOiLXSa1xxkLTUoD9jd oj/A== 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=lvrToaEoN1VBHc4fYW6HvbO3Cmqy0O9Rdyj55lsDG7E=; b=h7T5SgcCj/ItQlnB4QD1rtSdGxAG7FTG6qcgb7cs1RUdTHpA9/IhiPeJ+WhSYumYVb JznbXd75uA77DU+hOwm5Tu/6gRXeKYlwkov872xLCo9Pwl2itEPW4W1Ce/K7MkzSMLSO a9rSevvE5xpx+BzkCd4iRaXDXxhdS8KyZ7UjUFy19jHz2NQMbxSBtv/pNeagXNMahbBI /CDqZ8ircz348eukxyJhB/rfeU1C+ghPV2YpjDApFmr6/RFybspq6E6x/ovrxILW/xpP pvh6f2iitgZUDTsYOM526qBS86cEdfolsQMqtN0tQ3ydM5Rl68cN6gbdTzj8JJlS89AW i43A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fdi34Mex; 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 d18-20020a170902ced200b001865dfb6774si20128470plg.458.2022.10.24.05.42.05; Mon, 24 Oct 2022 05:42:20 -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=fdi34Mex; 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 S233996AbiJXMc3 (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233977AbiJXM3I (ORCPT ); Mon, 24 Oct 2022 08:29:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE88876A9; Mon, 24 Oct 2022 05:02:54 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 9F5A3612F0; Mon, 24 Oct 2022 12:02:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0E5AC433C1; Mon, 24 Oct 2022 12:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612959; bh=HBy6+WmctVCFgQnZHbWI3wpfmscQhg4m+1LqT9t11gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fdi34MexhO9PSH7fYTllHDpXtCgO5tMYpiwkOcI2s0JpVRqJWhh20VbOVQ5otHyub aD8dlcPCTF9ZFabrzWDhiYj0HVrmfbsxsF02aVgZdjp9j0CBjwiySy7MffoocOIHyW xSeaI9uMBRk5hcMJ/7CTBDm6PhtIUgCswabzFDm8= 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 4.19 153/229] mfd: sm501: Add check for platform_driver_register() Date: Mon, 24 Oct 2022 13:31:12 +0200 Message-Id: <20221024113003.961820486@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747572847741466178?= X-GMAIL-MSGID: =?utf-8?q?1747572847741466178?= 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 ec1ac61a21ed..6254b4025b5e 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1738,7 +1738,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); }