From patchwork Sun Dec 11 07:08:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 32160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1659576wrr; Sat, 10 Dec 2022 23:40:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf5tbaiSdossGMuNeGypouoloQe4hncbbg22SNPd/AJsPXCSJpHavtBWvGyBSVH8em87LhC+ X-Received: by 2002:a17:907:cf88:b0:7b9:f909:842 with SMTP id ux8-20020a170907cf8800b007b9f9090842mr10066153ejc.56.1670744448653; Sat, 10 Dec 2022 23:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670744448; cv=none; d=google.com; s=arc-20160816; b=POQVIedZ2HYUCDABOKycfjyzYP/MzWVX10YaJdmvVBad9ZBi6RQZWb1GMdn8KOvh4C klB1kbyKtb1WmGlkXxKqoL6fTQkFyvLi9US5U2lq8D7adYDc3gdk2dm9f8zqteCjKxvk ucTosEUUVzOpUTBR3bBzJUyQumUQCNNkDRRhXI7v0LElL0Lh6LwCClXNYoDl40761/i2 /xkxrYpgkzYTyrY62QmKS3n3OO9tCX1QpjhG+nH0630gOP6fjJd599TDwGtL3ARvOjap rDa/0KXCz7JeCpG9E1IRfLHsYkOOWgQ6t8TQE6oYiNgAhLke0VS0nN8n5rz4fiKfmqNp GQIw== 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 :message-id:date:subject:cc:to:from; bh=EdNb721uB1Ms6RYkV1ZnM1wVtJ/rPmlUQucyHZhe2QI=; b=YbTTHgojBn7DgDk6lKsdRS7vx66k7NNRfiu4cXX/677vHaMyUr//GTZoplIgtgsfpC owouBXxfqMsSEIwZseFToGv5V5uui5ZVZSiO+r7v+CZRS0YO8zYK0CmxoQpBHbF/7kRP I2stqu08ArryHvvTC5PRD6wa8Kh4QT3jQTk+bQHi/6XKxl9fnYQXJTRNpKPIHOj510Ou bgIoCjbUSQz3rCNIYgy+uTJmcjuUBqCc0VjL6mrqSXwrEfzA4jufa4cl5yDmdJdmWg7c tMX2uXohutt1j3XrINip2ZnDHZPUute9bcDQjbG1Sq+MfgTijTmQMoHhRP4pdsRdypm7 91Aw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz5-20020a1709072ce500b007ae127c6c7asi4028145ejc.176.2022.12.10.23.40.10; Sat, 10 Dec 2022 23:40:48 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230196AbiLKHIp (ORCPT + 99 others); Sun, 11 Dec 2022 02:08:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbiLKHIn (ORCPT ); Sun, 11 Dec 2022 02:08:43 -0500 Received: from smtp.smtpout.orange.fr (smtp-11.smtpout.orange.fr [80.12.242.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8576D11816 for ; Sat, 10 Dec 2022 23:08:42 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id 4GRzpHRqabLgJ4GRzp7eVK; Sun, 11 Dec 2022 08:08:40 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 11 Dec 2022 08:08:40 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Linus Walleij , Sebastien Bourdelin , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] bus: ts-nbus: Fix the error handling path of ts_nbus_probe() Date: Sun, 11 Dec 2022 08:08:38 +0100 Message-Id: <6e14d11b9725494b55df9939bde3fc5b8eaef6e4.1670742502.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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?1751902530856779938?= X-GMAIL-MSGID: =?utf-8?q?1751902530856779938?= If an error occurs after a successful pwm_enable() call, it must be undone by a corresponding pwm_disable(), as already done in the remove function. Fixes: 5b143d2a6ede ("bus: add driver for the Technologic Systems NBUS") Signed-off-by: Christophe JAILLET --- Not sure if we need the mutex_lock()/mutex_unlock() that is in the remove function. --- drivers/bus/ts-nbus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/bus/ts-nbus.c b/drivers/bus/ts-nbus.c index 38c886dc2ed6..ed568061ba6b 100644 --- a/drivers/bus/ts-nbus.c +++ b/drivers/bus/ts-nbus.c @@ -324,11 +324,16 @@ static int ts_nbus_probe(struct platform_device *pdev) ret = of_platform_populate(dev->of_node, NULL, NULL, dev); if (ret < 0) - return ret; + goto err_disable_pwm; dev_info(dev, "initialized\n"); return 0; + +err_disable_pwm: + pwm_disable(pwm); + return ret; + } static int ts_nbus_remove(struct platform_device *pdev)