lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 14 Sep 2020 11:03:23 +0200
From:   Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        "Daniel W. S. Almeida" <dwlsalmeida@...il.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-kernel@...r.kernel.org, linux-media@...r.kernel.org
Subject: [PATCH RFC 08/11] media: vidtv: properly initialize the internal state struct

Right now, the config data passed from the bridge driver is
just ignored.

Also, let's initialize the delayed work at probing time.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
 drivers/media/test-drivers/vidtv/vidtv_demod.c | 10 +++++-----
 drivers/media/test-drivers/vidtv/vidtv_demod.h |  1 -
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.c b/drivers/media/test-drivers/vidtv/vidtv_demod.c
index 3eb48b4a9a6b..6199a4e06ff9 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_demod.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_demod.c
@@ -268,10 +268,6 @@ static int vidtv_demod_init(struct dvb_frontend *fe)
 	struct vidtv_demod_state *state = fe->demodulator_priv;
 	u32    tuner_status             = 0;
 
-	if (state->cold_start)
-		INIT_DELAYED_WORK(&state->poll_snr,
-				  &vidtv_demod_poll_snr_handler);
-
 	/*
 	 * At resume, start the snr poll thread only if it was suspended with
 	 * the thread running. Extra care should be taken here, as some tuner
@@ -288,7 +284,6 @@ static int vidtv_demod_init(struct dvb_frontend *fe)
 		state->poll_snr_thread_restart = false;
 	}
 
-	state->cold_start = false;
 	return 0;
 }
 
@@ -396,6 +391,7 @@ MODULE_DEVICE_TABLE(i2c, vidtv_demod_i2c_id_table);
 static int vidtv_demod_i2c_probe(struct i2c_client *client,
 				 const struct i2c_device_id *id)
 {
+	struct vidtv_tuner_config *config = client->dev.platform_data;
 	struct vidtv_demod_state *state;
 
 	/* allocate memory for the internal state */
@@ -408,6 +404,10 @@ static int vidtv_demod_i2c_probe(struct i2c_client *client,
 	       &vidtv_demod_ops,
 	       sizeof(struct dvb_frontend_ops));
 
+	memcpy(&state->config, config, sizeof(state->config));
+
+	INIT_DELAYED_WORK(&state->poll_snr, &vidtv_demod_poll_snr_handler);
+
 	state->frontend.demodulator_priv = state;
 	i2c_set_clientdata(client, state);
 
diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.h b/drivers/media/test-drivers/vidtv/vidtv_demod.h
index dfb36c515e4d..7f52a537935b 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_demod.h
+++ b/drivers/media/test-drivers/vidtv/vidtv_demod.h
@@ -66,7 +66,6 @@ struct vidtv_demod_state {
 	struct delayed_work poll_snr;
 	enum fe_status status;
 	u16 tuner_cnr;
-	bool cold_start;
 	bool poll_snr_thread_running;
 	bool poll_snr_thread_restart;
 };
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ