Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 084e24ac authored by Matthias Schwarzott's avatar Matthias Schwarzott Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly



This patch changes most frontend drivers to allocate their state structure via
kzalloc and not kmalloc. This is done to properly initialize the
embedded "struct dvb_frontend frontend" field, that they all have.

The visible effect of this struct being uninitalized is, that the member "id"
that is used to set the name of kernel thread is totally random.

Some board drivers (for example cx88-dvb) set this "id" via
videobuf_dvb_alloc_frontend but most do not.

So I at least get random id values for saa7134, flexcop and ttpci based cards.
It looks like this in dmesg:
DVB: registering adapter 1 frontend -10551321 (ST STV0299 DVB-S)

The related kernel thread then also gets a strange name
like "kdvb-ad-1-fe--1".

Cc: Michael Krufky <mkrufky@linuxtv.org>
Cc: Steven Toth <stoth@linuxtv.org>
Cc: Timothy Lee <timothy.lee@siriushk.com>
Cc: Igor M. Liplianin <liplianin@me.by>
Signed-off-by: default avatarMatthias Schwarzott <zzam@gentoo.org>
Acked-by: default avatarAndreas Oberritter <obi@linuxtv.org>
Signed-off-by: default avatarDouglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent bb2b4542
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -380,7 +380,7 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config,
	struct cx22700_state* state = NULL;
	struct cx22700_state* state = NULL;


	/* allocate memory for the internal state */
	/* allocate memory for the internal state */
	state = kmalloc(sizeof(struct cx22700_state), GFP_KERNEL);
	state = kzalloc(sizeof(struct cx22700_state), GFP_KERNEL);
	if (state == NULL) goto error;
	if (state == NULL) goto error;


	/* setup the state */
	/* setup the state */
+1 −1
Original line number Original line Diff line number Diff line
@@ -580,7 +580,7 @@ struct dvb_frontend *cx22702_attach(const struct cx22702_config *config,
	struct cx22702_state *state = NULL;
	struct cx22702_state *state = NULL;


	/* allocate memory for the internal state */
	/* allocate memory for the internal state */
	state = kmalloc(sizeof(struct cx22702_state), GFP_KERNEL);
	state = kzalloc(sizeof(struct cx22702_state), GFP_KERNEL);
	if (state == NULL)
	if (state == NULL)
		goto error;
		goto error;


+1 −1
Original line number Original line Diff line number Diff line
@@ -598,7 +598,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
	int ret;
	int ret;


	/* allocate memory for the internal state */
	/* allocate memory for the internal state */
	state = kmalloc(sizeof(struct cx24110_state), GFP_KERNEL);
	state = kzalloc(sizeof(struct cx24110_state), GFP_KERNEL);
	if (state == NULL) goto error;
	if (state == NULL) goto error;


	/* setup the state */
	/* setup the state */
+3 −3
Original line number Original line Diff line number Diff line
@@ -117,7 +117,7 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
	struct dvb_dummy_fe_state* state = NULL;
	struct dvb_dummy_fe_state* state = NULL;


	/* allocate memory for the internal state */
	/* allocate memory for the internal state */
	state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
	if (state == NULL) goto error;
	if (state == NULL) goto error;


	/* create dvb_frontend */
	/* create dvb_frontend */
@@ -137,7 +137,7 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void)
	struct dvb_dummy_fe_state* state = NULL;
	struct dvb_dummy_fe_state* state = NULL;


	/* allocate memory for the internal state */
	/* allocate memory for the internal state */
	state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
	if (state == NULL) goto error;
	if (state == NULL) goto error;


	/* create dvb_frontend */
	/* create dvb_frontend */
@@ -157,7 +157,7 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void)
	struct dvb_dummy_fe_state* state = NULL;
	struct dvb_dummy_fe_state* state = NULL;


	/* allocate memory for the internal state */
	/* allocate memory for the internal state */
	state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
	state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
	if (state == NULL) goto error;
	if (state == NULL) goto error;


	/* create dvb_frontend */
	/* create dvb_frontend */
+1 −1
Original line number Original line Diff line number Diff line
@@ -501,7 +501,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config,
			   { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } };
			   { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } };


	/* allocate memory for the internal state */
	/* allocate memory for the internal state */
	state = kmalloc(sizeof(struct l64781_state), GFP_KERNEL);
	state = kzalloc(sizeof(struct l64781_state), GFP_KERNEL);
	if (state == NULL) goto error;
	if (state == NULL) goto error;


	/* setup the state */
	/* setup the state */
Loading