From patchwork Sat Feb 17 15:03:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10226221 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 86AF6602CB for ; Sat, 17 Feb 2018 15:03:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80C7728B05 for ; Sat, 17 Feb 2018 15:03:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7514128C71; Sat, 17 Feb 2018 15:03:39 +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 0262528B05 for ; Sat, 17 Feb 2018 15:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751104AbeBQPDg (ORCPT ); Sat, 17 Feb 2018 10:03:36 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:53944 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751090AbeBQPDe (ORCPT ); Sat, 17 Feb 2018 10:03:34 -0500 Received: by mail-wm0-f66.google.com with SMTP id t74so7942508wme.3 for ; Sat, 17 Feb 2018 07:03:33 -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=TCsyYzMGqHCiEAJg9MrEQLdqQ/XkC534mI60JZ4+KycIaBsnLkoFIe/hPeByw3BWC7 tJX8pnDuvTxyxClafy9lIu9L4rujb5jJrvWNzo9JObwuLcZZ+MBHFNGgyCeICGTDpJQf ZKZMc1jBm/PKtvOV1BxeYSRyq3Jy3LQ4kTwCl1v/y+ZjzpAXTdM45h8L8LtIG406/Khz ACEurcNfqOcJzHVi9F8x4a6VVnG7GXDg0BslzNCrXRAM6WO5yReRA7u26k7mXIhjn0QM gQbIm4kzziEQKqAu4fNAqOX4ks2nZJy2jp41fe1Kw3NzA2CiBBK/UauLFqSf8XJZhskP n3UQ== 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=BIdX2H0wXbAN39+Xc4bQDZqVw6msuDIZPVU87G1hPkseiOF3YK4Xcf+sSWNArLsbuL +/VG8poMG6Hkmi8zz+PlSrLyhjQAUpDMlm6O9acN+iP+ndOrQQRSoyn99YrW+ybNe+RE LcEn0TMqG7pYhwtdzsyxqk8FujfStTn1GLTcqp6UbQ5sag6SgFHP0fxdHkor531lYqfQ f051Tc7nkNPXb3v1ihLRWRS7MMcgfxzje4e1pZbqA7f79MjfU2h0Fn8Nt8Y6rTk/vy7T yayJHF6FjqZJ3PzMvYf6lSJA3SCxcDl89STjs66ZmS2qHaphzeInOLLNV+fXgWLxPJ3T iPlg== X-Gm-Message-State: APf1xPCtbSBLEiEC6OotqzufbQS9zaW8dg/GlOEvEdQ+BWjgIUqFDNs3 dYFn09go2NzF+AOWQCVS5sUwxg== X-Google-Smtp-Source: AH8x226hHSB04p/yOW+YPpEWEDsffF3R9Xk+5nCFHm2HbuAfYhruOpJpNpR7v0SgITdc5mXJOqc/QQ== X-Received: by 10.28.94.12 with SMTP id s12mr6795961wmb.155.1518879812906; Sat, 17 Feb 2018 07:03:32 -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 f142sm2740628wme.15.2018.02.17.07.03.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Feb 2018 07:03:32 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: jasmin@anw.at Subject: [PATCH v2 1/7] [media] ddbridge/ci: further deduplicate code/logic in ddb_ci_attach() Date: Sat, 17 Feb 2018 16:03:22 +0100 Message-Id: <20180217150328.686-2-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180217150328.686-1-d.scheller.oss@gmail.com> References: <20180217150328.686-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; }