From patchwork Sun Dec 17 15:40:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10117751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0104A60327 for ; Sun, 17 Dec 2017 15:41:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 081C1292A1 for ; Sun, 17 Dec 2017 15:41:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F12CC293AD; Sun, 17 Dec 2017 15:41:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 913AC292A1 for ; Sun, 17 Dec 2017 15:41:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757287AbdLQPlI (ORCPT ); Sun, 17 Dec 2017 10:41:08 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:45844 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751812AbdLQPlB (ORCPT ); Sun, 17 Dec 2017 10:41:01 -0500 Received: by mail-wm0-f67.google.com with SMTP id 9so25050479wme.4 for ; Sun, 17 Dec 2017 07:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=NhPWdFX9/JoMdWDe05qWo+OWUzy+eAHaUIoQZkjqxNU=; b=go1Ar7ELyUfFd2wajb9b/b+KG/91HSA9TXNB2LnHsn3HKdhQkSEJCuxmhrZ0PDeWoX tBN2pZpf8Tz8a3Y18+UdZrqaJg9L07agHWbfJW8Pxy6bhqe3qq8DZE2+OpKk2b3UjdML jh/pAVslJTJ8o+UIx5ta6mbuY6H2lpwihpEeTN1K9lVzSa6JW7K7sT1C5SVBWFy57zsp V1SwvM6jONj/a0ymJGt9yU6auH0ZLEsVBsl7561QCpJOXyIpBJbK3XiXE0SAhT0PSHSE Ts4g0xRD9v6xk45e/JCXtlIsThs/brwfjO/HEssGaNQzUjN+dh83DvnPwShoWCmDYqcZ 53+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=NhPWdFX9/JoMdWDe05qWo+OWUzy+eAHaUIoQZkjqxNU=; b=hI5wva20GDM4E8U6VT1F7w6RLDmI3sbyflmFOII/6ruPpiwjvnJmOHWWuUzWvMzvVj SzUa1DF1kUTSuP6tZwKHyY/kV5QlOX5lVkdlKcRYymP+PI3gz+OSlGb7HJg0/SAcJlMh eaAubIpAxbDg4gn5wGefMJCwLhVY/DNtAMVrlnmhhnW4YsgET4zzSvs005nsJAtShy81 UiwIb3LkqAddn0kIy+vdARjm87Z92wbMOGSu9O0J8CAba0GjRMVTNH1AjvN2xw0MA/j2 cPO1yCs1xLBr+G0zsTPPz/kTY88YV1AIIKZUDWwMWCJaMybiliUPu46VuPWc9J5r0YK4 CDlg== X-Gm-Message-State: AKGB3mJuv/bkJ5meHDp1wrTPeYCszlEjvGNf78XptvXfiLSaVHIA8odm z/BqSjh3Dk5u7+rGajKexcjjew== X-Google-Smtp-Source: ACJfBoveVxVuTUdd0BcWcXVz/xPSr4pD6xo/UQr6yL1NhNC5OUN/1jZ8LRQ1b9m0Gx1J7AjvOKuEag== X-Received: by 10.28.23.196 with SMTP id 187mr10108414wmx.101.1513525260237; Sun, 17 Dec 2017 07:41:00 -0800 (PST) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id m52sm2420974wrm.12.2017.12.17.07.40.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Dec 2017 07:40:59 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 7/8] [media] ddbridge: detach first input if the second one failed to init Date: Sun, 17 Dec 2017 16:40:48 +0100 Message-Id: <20171217154049.1125-8-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171217154049.1125-1-d.scheller.oss@gmail.com> References: <20171217154049.1125-1-d.scheller.oss@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller In ddb_ports_attach(), if the second input of a dual tuner failed to initialise, the first one can be detached (and resources be freed) as this will be counted as the whole port having failed to initialise, thus the first one won't be used anyway. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 548b7047ca09..940371067346 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -1935,8 +1935,10 @@ static int ddb_port_attach(struct ddb_port *port) if (ret < 0) break; ret = dvb_input_attach(port->input[1]); - if (ret < 0) + if (ret < 0) { + dvb_input_detach(port->input[0]); break; + } port->input[0]->redi = port->input[0]; port->input[1]->redi = port->input[1]; break;