public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Scheller <d.scheller.oss@gmail.com>
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	[thread overview]
Message-ID: <20180208195318.612-2-d.scheller.oss@gmail.com> (raw)
In-Reply-To: <20180208195318.612-1-d.scheller.oss@gmail.com>

From: Daniel Scheller <d.scheller@gmx.net>

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 <d.scheller@gmx.net>
---
 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;
 }
-- 
2.13.6

  reply	other threads:[~2018-02-08 19:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 19:53 [PATCH 0/7] cxd2099: convert to regmap API and move out of staging Daniel Scheller
2018-02-08 19:53 ` Daniel Scheller [this message]
2018-02-08 19:53 ` [PATCH 2/7] [media] staging/cxd2099: convert to regmap API Daniel Scheller
2018-02-08 19:53 ` [PATCH 3/7] [media] ddbridge: adapt cxd2099 attach to new i2c_client way Daniel Scheller
2018-02-08 19:53 ` [PATCH 4/7] [media] ngene: adapt cxd2099 attach to the " Daniel Scheller
2018-02-08 19:53 ` [PATCH 5/7] [media] staging/cxd2099: remove remainders from old attach way Daniel Scheller
2018-02-08 19:53 ` [PATCH 6/7] [media] cxd2099: move driver out of staging into dvb-frontends Daniel Scheller
2018-02-08 19:53 ` [PATCH 7/7] [media] MAINTAINERS: add entry for cxd2099 Daniel Scheller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180208195318.612-2-d.scheller.oss@gmail.com \
    --to=d.scheller.oss@gmail.com \
    --cc=jasmin@anw.at \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mchehab@s-opensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox