From patchwork Thu Feb 8 19:53:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10207913 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 3D3E5602D8 for ; Thu, 8 Feb 2018 19:53:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EC9828E5E for ; Thu, 8 Feb 2018 19:53:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D38229625; Thu, 8 Feb 2018 19:53:28 +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 064C62961E for ; Thu, 8 Feb 2018 19:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752574AbeBHTxZ (ORCPT ); Thu, 8 Feb 2018 14:53:25 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34845 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbeBHTxY (ORCPT ); Thu, 8 Feb 2018 14:53:24 -0500 Received: by mail-wm0-f65.google.com with SMTP id r78so12230861wme.0 for ; Thu, 08 Feb 2018 11:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yI+folPUSz3GQJFsK41zmvhFQ76cr/XpV1JFzEQLnrM=; b=R6NfrXqOL7+CxP3Dc75rSUV1zjeTHrqdjiYQSAXRuVX8+x+Cs/DNm9OiofPnbVUjn8 gpdzbVi54W7xLI3La97WFNW2MoKX32uIsM7zyXqDk0hZdX4iLbdVg53pxGXNqnHMB3rh OsZv0wORni644nmPSKIYjgGGO8qr+2msPnL7c8gbHfEcODGVpiLJca2Id3ptaNCrDP// UypRcQRnT2uUdUC7/9ZHwfawiYuUA5thnTqv06nTm/CObHoKwS3qbPOUWIvR6B5ezllK TVp5tsl7pR2HWQnD9c/BkBu46/JI0CLCch4XwxYXHG9hAcISR+1RIi00IJ9oMi4Jm5Hl M/kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yI+folPUSz3GQJFsK41zmvhFQ76cr/XpV1JFzEQLnrM=; b=dr6JCpLRMVhWDiko8F7y7ws5mj2LVGUJOTyJgqH73+gUXe/7v4M/RdFy82Epu9kd9C BKtWM8MscEvBMoBUZ874UMqXnb1zRBNAMaTt44F2uSznvAI6CRlGdfO2t/USKRyUe8zn /3bXfDAbJaMMH0QJ64xheu4RIMZBm099c8gWEkQFza7Erk345/kGS8ME/q/iR5eeZ6DT BORiveJ73dqIAmTgt0jLFT2fP8RYM2M/FRE3SB/thwah35ZYomPmPWhnNsv+LarB03c8 f063XVlQ4znet2rBZEntSJOlxKoKmO1eryib9SxyEf5VIpOj7hznDc646t7xI16bKs4j RGCg== X-Gm-Message-State: APf1xPCMKUu0vR0UUP1F5NBY1ZIg7q5eEsovPu75V0eF843PcZHrm+If Ri3GpJ8RdDjuWtcZ7NahfO23Aw== X-Google-Smtp-Source: AH8x224AOROq1e8ZaCYe142eHXgDysszt3MBLoM5W0JvBUadM1455MR1NeHIUQUpBjXbkqxLddnCLA== X-Received: by 10.28.210.145 with SMTP id j139mr147465wmg.59.1518119602751; Thu, 08 Feb 2018 11:53:22 -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 78sm746190wmm.22.2018.02.08.11.53.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 11:53:21 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: jasmin@anw.at Subject: [PATCH 1/7] [media] ddbridge/ci: further deduplicate code/logic in ddb_ci_attach() Date: Thu, 8 Feb 2018 20:53:12 +0100 Message-Id: <20180208195318.612-2-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180208195318.612-1-d.scheller.oss@gmail.com> References: <20180208195318.612-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 Deduplicate the checks for a valid ptr in port->en, and also handle the default case to also catch eventually yet unsupported CI hardware. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-ci.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-ci.c b/drivers/media/pci/ddbridge/ddbridge-ci.c index 5828111487b0..ed19890710d6 100644 --- a/drivers/media/pci/ddbridge/ddbridge-ci.c +++ b/drivers/media/pci/ddbridge/ddbridge-ci.c @@ -325,24 +325,20 @@ int ddb_ci_attach(struct ddb_port *port, u32 bitrate) case DDB_CI_EXTERNAL_SONY: cxd_cfg.bitrate = bitrate; port->en = cxd2099_attach(&cxd_cfg, port, &port->i2c->adap); - if (!port->en) - return -ENODEV; break; - case DDB_CI_EXTERNAL_XO2: case DDB_CI_EXTERNAL_XO2_B: ci_xo2_attach(port); - if (!port->en) - return -ENODEV; break; - case DDB_CI_INTERNAL: ci_attach(port); - if (!port->en) - return -ENODEV; break; + default: + return -ENODEV; } + if (!port->en) + return -ENODEV; dvb_ca_en50221_init(port->dvb[0].adap, port->en, 0, 1); return 0; }