Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1254954imw; Tue, 5 Jul 2022 06:30:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vj4ziE2U5keWbi0kytnGFrV+ZMENPpzZ12Gg0HOaJDOdhQqNym48jb8YZzamNWlwtkQyiA X-Received: by 2002:a17:906:7482:b0:722:ea8f:3a12 with SMTP id e2-20020a170906748200b00722ea8f3a12mr34326101ejl.220.1657027837426; Tue, 05 Jul 2022 06:30:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657027837; cv=none; d=google.com; s=arc-20160816; b=mCDySfKp9oYtUGxe8GH7Ol1otqPTw6MbfA7le5TIC9jTV4vAZ7MoGAZ93dWD5x93NI yttx+5CJJO89/e0Ji/Y595pMNPqGmFyE7xGgy0jp2AaL1EjdFLAv9jW78Pv2zIX/9UQz KnBpcYg4ddUXe0FB6zeenjjHb2NL6JwgjfmkT+KnOD4f1AL70eA47n6ybBTGMG6RguFM Hwv5UdDJItn1/MIfgavLnLTKDdzRWJpL6YcI6n0dE84rUppEr4NvUYeu693a8+ob5L1k S3PGLY7bGtLceVZaVY6tNkX5lMKImVsIKLBI4EZa4gdIBBf5AwEY6wSIb9uj03TUZvvc 9v3w== 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=7MpqY2uSUP5zZtXdoGMoJXftvyVEmH+VJfl4FZMC4i4=; b=TIQP2i28NfVisrWNusFC56lqFdeUCDpO5N4ucSKuYr+SA84gLpheW5ww5qoXG8jy43 9ROEyJyvBS3brmfDr0FHpgVkoAkBrtrkvUUD1MCmlvtf+hC845H+cxXrr5RDAbyWxKtr 4NLRMh7OZ6165egXP/lZbnsf2gECiZOYZtjvYfdPHquBD2W3bzIvv0CbrVY9G8k51Gr9 2n5MZqorhcNdRUqtNAVRna89M6faQyhMzd3jFogiukVVsVLEV3mLbG4tfoA6gsHpnBwY a7s1K6yVLh3NAyxOD0FS8JNbQZYK2uy2mN/wlz4SlTFh5XO98NDpnWmq0voWcPoMzdTq iPPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eE7McLu6; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a1709065d1000b0072ab4e654basi12173760ejt.707.2022.07.05.06.30.11; Tue, 05 Jul 2022 06:30:37 -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=eE7McLu6; 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 S236146AbiGEMQ4 (ORCPT + 99 others); Tue, 5 Jul 2022 08:16:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234242AbiGEMHP (ORCPT ); Tue, 5 Jul 2022 08:07:15 -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 B30D715FF4; Tue, 5 Jul 2022 05:06:05 -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 492CB61806; Tue, 5 Jul 2022 12:06:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54BE6C341CD; Tue, 5 Jul 2022 12:06:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657022764; bh=ObRHg1ThxVQ9rgkmBwdsLcAZl7+Jll0LtHwMU6/TJTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eE7McLu6D1c0bORqD77ge5bsk1q5dUq8KYJlYDXdILb9h9zA1RQKw5bCa1NHupjcA DIuS9EeYtUJNPfy3gBFqUeFZkwXKDZ1ANC+WuN5AQFVl+9DQW7Ff/OYdoUcHIgVA3y +qvhCFAeAtJhyHxQanSXsf4TfoAcYRo6jiGV75uo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , Guenter Roeck , Sasha Levin Subject: [PATCH 5.4 30/58] hwmon: (ibmaem) dont call platform_device_del() if platform_device_add() fails Date: Tue, 5 Jul 2022 13:58:06 +0200 Message-Id: <20220705115611.133077410@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705115610.236040773@linuxfoundation.org> References: <20220705115610.236040773@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 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,T_SCC_BODY_TEXT_LINE 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 From: Yang Yingliang [ Upstream commit d0e51022a025ca5350fafb8e413a6fe5d4baf833 ] If platform_device_add() fails, it no need to call platform_device_del(), split platform_device_unregister() into platform_device_del/put(), so platform_device_put() can be called separately. Fixes: 8808a793f052 ("ibmaem: new driver for power/energy/temp meters in IBM System X hardware") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220701074153.4021556-1-yangyingliang@huawei.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/ibmaem.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/hwmon/ibmaem.c +++ b/drivers/hwmon/ibmaem.c @@ -550,7 +550,7 @@ static int aem_init_aem1_inst(struct aem res = platform_device_add(data->pdev); if (res) - goto ipmi_err; + goto dev_add_err; platform_set_drvdata(data->pdev, data); @@ -598,7 +598,9 @@ hwmon_reg_err: ipmi_destroy_user(data->ipmi.user); ipmi_err: platform_set_drvdata(data->pdev, NULL); - platform_device_unregister(data->pdev); + platform_device_del(data->pdev); +dev_add_err: + platform_device_put(data->pdev); dev_err: ida_simple_remove(&aem_ida, data->id); id_err: @@ -690,7 +692,7 @@ static int aem_init_aem2_inst(struct aem res = platform_device_add(data->pdev); if (res) - goto ipmi_err; + goto dev_add_err; platform_set_drvdata(data->pdev, data); @@ -738,7 +740,9 @@ hwmon_reg_err: ipmi_destroy_user(data->ipmi.user); ipmi_err: platform_set_drvdata(data->pdev, NULL); - platform_device_unregister(data->pdev); + platform_device_del(data->pdev); +dev_add_err: + platform_device_put(data->pdev); dev_err: ida_simple_remove(&aem_ida, data->id); id_err: