Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp443186iog; Mon, 13 Jun 2022 06:06:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz17BPCheYBESsv7UMsmmM1gWkvU+0x7sWtlDVvFqy8KmlhXw7cLDqgJO1MYVs13E3J1VUr X-Received: by 2002:a17:906:77d5:b0:712:171:d3b1 with SMTP id m21-20020a17090677d500b007120171d3b1mr20796860ejn.191.1655125590608; Mon, 13 Jun 2022 06:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125590; cv=none; d=google.com; s=arc-20160816; b=q90oSl6oV8sN57rPdockcCOdCpZ0uky6cGgj4YZHYOi9cjR3aSC1wsMp586qvLLZvz V4HNgUN1sdpc5LCwMJixwJBvhGiDG0ugjxmP9YCTFs9FwNnPtKfflnZF2gUhvSGAsZjY sgpx+rSnbpeng+1Ay05V8QadJlwa3pS1TPVWMjITr1ozvCM2Ge9A2WYSzPBP9VPYUR9+ YFm35LzrCGCjOpIQvHqTqRJVrS4odlGrqNx4B7fCgEvd/FMvCmI4DZLnJD5RrwPOO4LG KBkMzAtR6WrhKvpXKxaAMyJv4BeGBSqvRJpcoshl3LF5sonkB1S+mNWm3m5ZpuYTHdui Foqg== 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=+vFsiVk9i7O7TO43oDONZDYw10C/Ui+lLWgSnFAwqr8=; b=zsO8mXMfmNLibJLi/iorRpG6iW/PTQAddOCiAjKgnJ33PWyMRead78oaZtBGp9upL4 NSEFXjdTRfXDK6DTgWgQE+hesoUOx932dUKNOVuPurrqiFPvBLab1R/xPyz8OSorIvjf Mrc3hTaJrUpQq/AntZ2HhSq6rwcYRdPKk+JV4WSyaieMOKlOwFr4sd6y7n8N4bc/wYx3 s9S8+YvwvfV7YcRfDYrQ4JwOyFv0N+UZbZXf9Xy7KRGmvtajnUNxpr884evpcr0hrgyw aaaFx50vNPWwKqNPrxRbAZVhcjG3UBShRElmibhyIXaaZxKl8cKKdwXkzSlznTEtdqs/ iDzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zWaOrV3U; 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 i3-20020a1709064fc300b00703f39c8b0bsi8671322ejw.853.2022.06.13.06.05.50; Mon, 13 Jun 2022 06:06:30 -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=zWaOrV3U; 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 S1354980AbiFMLgq (ORCPT + 99 others); Mon, 13 Jun 2022 07:36:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354610AbiFML3q (ORCPT ); Mon, 13 Jun 2022 07:29:46 -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 53ACB237F8; Mon, 13 Jun 2022 03:45:14 -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 D09986119F; Mon, 13 Jun 2022 10:45:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E10F9C34114; Mon, 13 Jun 2022 10:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117113; bh=MEf+U+Deoyla42Ji83VwKQTPSFr85sVcD5337fJuBsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zWaOrV3Udeb4J0EyAnJFIZsdyN+YPLsldQfN+nNTpAR5cZLPOGDRsvePeVkoZAhEx xvB6paPBv76tgx/G6xpYVQkeQ7MH0RAZySHmsOaElIfg9mKQbHeKqaSsRLLRyEPGMd vC58PlWJZ6TPKA895/LvJX3FF+Z+j9N3+XWM6u9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Sasha Levin Subject: [PATCH 5.4 291/411] staging: fieldbus: Fix the error handling path in anybuss_host_common_probe() Date: Mon, 13 Jun 2022 12:09:24 +0200 Message-Id: <20220613094937.485639172@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@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=-8.3 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: Christophe JAILLET [ Upstream commit 7079b3483a17be2cfba64cbd4feb1b7ae07f1ea7 ] If device_register() fails, device_unregister() should not be called because it will free some resources that are not allocated. put_device() should be used instead. Fixes: 308ee87a2f1e ("staging: fieldbus: anybus-s: support HMS Anybus-S bus") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/5401a519608d6e1a4e7435c20f4f20b0c5c36c23.1650610082.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/fieldbus/anybuss/host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c index f69dc4930457..b7a91bdef6f4 100644 --- a/drivers/staging/fieldbus/anybuss/host.c +++ b/drivers/staging/fieldbus/anybuss/host.c @@ -1384,7 +1384,7 @@ anybuss_host_common_probe(struct device *dev, goto err_device; return cd; err_device: - device_unregister(&cd->client->dev); + put_device(&cd->client->dev); err_kthread: kthread_stop(cd->qthread); err_reset: -- 2.35.1