Commit ca545f7c authored by Mike Isely's avatar Mike Isely Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (5091): Pvrusb2: Use kzalloc in place of kmalloc/memset pairs

parent eca8ebfc
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -152,9 +152,8 @@ int pvr2_i2c_msp3400_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
	struct pvr2_msp3400_handler *ctxt;
	if (cp->handler) return 0;

	ctxt = kmalloc(sizeof(*ctxt),GFP_KERNEL);
	ctxt = kzalloc(sizeof(*ctxt),GFP_KERNEL);
	if (!ctxt) return 0;
	memset(ctxt,0,sizeof(*ctxt));

	ctxt->i2c_handler.func_data = ctxt;
	ctxt->i2c_handler.func_table = &msp3400_funcs;
+1 −2
Original line number Diff line number Diff line
@@ -83,9 +83,8 @@ struct pvr2_context *pvr2_context_create(
	void (*setup_func)(struct pvr2_context *))
{
	struct pvr2_context *mp = NULL;
	mp = kmalloc(sizeof(*mp),GFP_KERNEL);
	mp = kzalloc(sizeof(*mp),GFP_KERNEL);
	if (!mp) goto done;
	memset(mp,0,sizeof(*mp));
	pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_main id=%p",mp);
	mp->setup_func = setup_func;
	mutex_init(&mp->mutex);
+1 −2
Original line number Diff line number Diff line
@@ -231,9 +231,8 @@ int pvr2_i2c_cx2584x_v4l_setup(struct pvr2_hdw *hdw,
	if (cp->handler) return 0;
	if (!decoder_detect(cp)) return 0;

	ctxt = kmalloc(sizeof(*ctxt),GFP_KERNEL);
	ctxt = kzalloc(sizeof(*ctxt),GFP_KERNEL);
	if (!ctxt) return 0;
	memset(ctxt,0,sizeof(*ctxt));

	ctxt->handler.func_data = ctxt;
	ctxt->handler.func_table = &hfuncs;
+4 −10
Original line number Diff line number Diff line
@@ -1934,20 +1934,18 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
		return NULL;
	}

	hdw = kmalloc(sizeof(*hdw),GFP_KERNEL);
	hdw = kzalloc(sizeof(*hdw),GFP_KERNEL);
	pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_create: hdw=%p, type \"%s\"",
		   hdw,pvr2_device_names[hdw_type]);
	if (!hdw) goto fail;
	memset(hdw,0,sizeof(*hdw));
	hdw->tuner_signal_stale = !0;
	cx2341x_fill_defaults(&hdw->enc_ctl_state);

	hdw->control_cnt = CTRLDEF_COUNT;
	hdw->control_cnt += MPEGDEF_COUNT;
	hdw->controls = kmalloc(sizeof(struct pvr2_ctrl) * hdw->control_cnt,
	hdw->controls = kzalloc(sizeof(struct pvr2_ctrl) * hdw->control_cnt,
				GFP_KERNEL);
	if (!hdw->controls) goto fail;
	memset(hdw->controls,0,sizeof(struct pvr2_ctrl) * hdw->control_cnt);
	hdw->hdw_type = hdw_type;
	for (idx = 0; idx < hdw->control_cnt; idx++) {
		cptr = hdw->controls + idx;
@@ -1961,11 +1959,9 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
		cptr->info = control_defs+idx;
	}
	/* Define and configure additional controls from cx2341x module. */
	hdw->mpeg_ctrl_info = kmalloc(
	hdw->mpeg_ctrl_info = kzalloc(
		sizeof(*(hdw->mpeg_ctrl_info)) * MPEGDEF_COUNT, GFP_KERNEL);
	if (!hdw->mpeg_ctrl_info) goto fail;
	memset(hdw->mpeg_ctrl_info,0,
	       sizeof(*(hdw->mpeg_ctrl_info)) * MPEGDEF_COUNT);
	for (idx = 0; idx < MPEGDEF_COUNT; idx++) {
		cptr = hdw->controls + idx + CTRLDEF_COUNT;
		ciptr = &(hdw->mpeg_ctrl_info[idx].info);
@@ -2608,14 +2604,12 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, int enable_flag)
		pvr2_trace(PVR2_TRACE_FIRMWARE,
			   "Preparing to suck out CPU firmware");
		hdw->fw_size = 0x2000;
		hdw->fw_buffer = kmalloc(hdw->fw_size,GFP_KERNEL);
		hdw->fw_buffer = kzalloc(hdw->fw_size,GFP_KERNEL);
		if (!hdw->fw_buffer) {
			hdw->fw_size = 0;
			break;
		}

		memset(hdw->fw_buffer,0,hdw->fw_size);

		/* We have to hold the CPU during firmware upload. */
		pvr2_hdw_cpureset_assert(hdw,1);

+1 −2
Original line number Diff line number Diff line
@@ -897,12 +897,11 @@ static int pvr2_i2c_attach_inform(struct i2c_client *client)
	struct pvr2_hdw *hdw = (struct pvr2_hdw *)(client->adapter->algo_data);
	struct pvr2_i2c_client *cp;
	int fl = !(hdw->i2c_pend_types & PVR2_I2C_PEND_ALL);
	cp = kmalloc(sizeof(*cp),GFP_KERNEL);
	cp = kzalloc(sizeof(*cp),GFP_KERNEL);
	trace_i2c("i2c_attach [client=%s @ 0x%x ctxt=%p]",
		  client->name,
		  client->addr,cp);
	if (!cp) return -ENOMEM;
	memset(cp,0,sizeof(*cp));
	cp->hdw = hdw;
	INIT_LIST_HEAD(&cp->list);
	cp->client = client;
Loading