Skip to content

Commit f83ef46

Browse files
committed
Merge remote-tracking branch 'remotes/origin/at91-4.14-trunk/isc+fixes' into linux-4.14-at91
2 parents 755b782 + f379fa0 commit f83ef46

24 files changed

Lines changed: 600 additions & 286 deletions

File tree

drivers/media/common/cypress_firmware.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,9 @@ int cypress_load_firmware(struct usb_device *udev,
7474
struct hexline *hx;
7575
int ret, pos = 0;
7676

77-
hx = kmalloc(sizeof(struct hexline), GFP_KERNEL);
78-
if (!hx) {
79-
dev_err(&udev->dev, "%s: kmalloc() failed\n", KBUILD_MODNAME);
77+
hx = kmalloc(sizeof(*hx), GFP_KERNEL);
78+
if (!hx)
8079
return -ENOMEM;
81-
}
8280

8381
/* stop the CPU */
8482
hx->data[0] = 1;

drivers/media/common/siano/smscoreapi.c

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath)
447447
return entry;
448448
}
449449
}
450-
entry = kmalloc(sizeof(struct smscore_registry_entry_t), GFP_KERNEL);
450+
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
451451
if (entry) {
452452
entry->mode = default_mode;
453453
strcpy(entry->devpath, devpath);
@@ -536,9 +536,7 @@ int smscore_register_hotplug(hotplug_t hotplug)
536536
int rc = 0;
537537

538538
kmutex_lock(&g_smscore_deviceslock);
539-
540-
notifyee = kmalloc(sizeof(struct smscore_device_notifyee_t),
541-
GFP_KERNEL);
539+
notifyee = kmalloc(sizeof(*notifyee), GFP_KERNEL);
542540
if (notifyee) {
543541
/* now notify callback about existing devices */
544542
first = &g_smscore_devices;
@@ -627,7 +625,7 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer,
627625
{
628626
struct smscore_buffer_t *cb;
629627

630-
cb = kzalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL);
628+
cb = kzalloc(sizeof(*cb), GFP_KERNEL);
631629
if (!cb)
632630
return NULL;
633631

@@ -655,7 +653,7 @@ int smscore_register_device(struct smsdevice_params_t *params,
655653
struct smscore_device_t *dev;
656654
u8 *buffer;
657655

658-
dev = kzalloc(sizeof(struct smscore_device_t), GFP_KERNEL);
656+
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
659657
if (!dev)
660658
return -ENOMEM;
661659

@@ -751,7 +749,7 @@ static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev,
751749
void *buffer, size_t size, struct completion *completion) {
752750
int rc;
753751

754-
if (completion == NULL)
752+
if (!completion)
755753
return -EINVAL;
756754
init_completion(completion);
757755

@@ -1153,8 +1151,8 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
11531151
}
11541152
pr_debug("Firmware name: %s\n", fw_filename);
11551153

1156-
if (loadfirmware_handler == NULL && !(coredev->device_flags
1157-
& SMS_DEVICE_FAMILY2))
1154+
if (!loadfirmware_handler &&
1155+
!(coredev->device_flags & SMS_DEVICE_FAMILY2))
11581156
return -EINVAL;
11591157

11601158
rc = request_firmware(&fw, fw_filename, coredev->device);
@@ -1301,10 +1299,8 @@ static int smscore_init_device(struct smscore_device_t *coredev, int mode)
13011299

13021300
buffer = kmalloc(sizeof(struct sms_msg_data) +
13031301
SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA);
1304-
if (!buffer) {
1305-
pr_err("Could not allocate buffer for init device message.\n");
1302+
if (!buffer)
13061303
return -ENOMEM;
1307-
}
13081304

13091305
msg = (struct sms_msg_data *)SMS_ALIGN_ADDRESS(buffer);
13101306
SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ,
@@ -1686,11 +1682,10 @@ static int smscore_validate_client(struct smscore_device_t *coredev,
16861682
pr_err("The msg ID already registered to another client.\n");
16871683
return -EEXIST;
16881684
}
1689-
listentry = kzalloc(sizeof(struct smscore_idlist_t), GFP_KERNEL);
1690-
if (!listentry) {
1691-
pr_err("Can't allocate memory for client id.\n");
1685+
listentry = kzalloc(sizeof(*listentry), GFP_KERNEL);
1686+
if (!listentry)
16921687
return -ENOMEM;
1693-
}
1688+
16941689
listentry->id = id;
16951690
listentry->data_type = data_type;
16961691
list_add_locked(&listentry->entry, &client->idlist,
@@ -1724,11 +1719,9 @@ int smscore_register_client(struct smscore_device_t *coredev,
17241719
return -EEXIST;
17251720
}
17261721

1727-
newclient = kzalloc(sizeof(struct smscore_client_t), GFP_KERNEL);
1728-
if (!newclient) {
1729-
pr_err("Failed to allocate memory for client.\n");
1722+
newclient = kzalloc(sizeof(*newclient), GFP_KERNEL);
1723+
if (!newclient)
17301724
return -ENOMEM;
1731-
}
17321725

17331726
INIT_LIST_HEAD(&newclient->idlist);
17341727
newclient->coredev = coredev;
@@ -1796,15 +1789,15 @@ int smsclient_sendrequest(struct smscore_client_t *client,
17961789
struct sms_msg_hdr *phdr = (struct sms_msg_hdr *) buffer;
17971790
int rc;
17981791

1799-
if (client == NULL) {
1792+
if (!client) {
18001793
pr_err("Got NULL client\n");
18011794
return -EINVAL;
18021795
}
18031796

18041797
coredev = client->coredev;
18051798

18061799
/* check that no other channel with same id exists */
1807-
if (coredev == NULL) {
1800+
if (!coredev) {
18081801
pr_err("Got NULL coredev\n");
18091802
return -EINVAL;
18101803
}
@@ -1961,7 +1954,7 @@ int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num,
19611954
if (pin_num > MAX_GPIO_PIN_NUMBER)
19621955
return -EINVAL;
19631956

1964-
if (p_gpio_config == NULL)
1957+
if (!p_gpio_config)
19651958
return -EINVAL;
19661959

19671960
total_len = sizeof(struct sms_msg_hdr) + (sizeof(u32) * 6);

drivers/media/dvb-frontends/as102_fe.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,10 @@ struct dvb_frontend *as102_attach(const char *name,
455455
struct as102_state *state;
456456
struct dvb_frontend *fe;
457457

458-
state = kzalloc(sizeof(struct as102_state), GFP_KERNEL);
459-
if (state == NULL) {
460-
pr_err("%s: unable to allocate memory for state\n", __func__);
458+
state = kzalloc(sizeof(*state), GFP_KERNEL);
459+
if (!state)
461460
return NULL;
462-
}
461+
463462
fe = &state->frontend;
464463
fe->demodulator_priv = state;
465464
state->ops = ops;

drivers/media/dvb-frontends/cx24113.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,11 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
552552
const struct cx24113_config *config, struct i2c_adapter *i2c)
553553
{
554554
/* allocate memory for the internal state */
555-
struct cx24113_state *state =
556-
kzalloc(sizeof(struct cx24113_state), GFP_KERNEL);
555+
struct cx24113_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
557556
int rc;
558-
if (state == NULL) {
559-
cx_err("Unable to kzalloc\n");
557+
558+
if (!state)
560559
goto error;
561-
}
562560

563561
/* setup the state */
564562
state->config = config;

drivers/media/dvb-frontends/cx24116.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ static int cx24116_writeregN(struct cx24116_state *state, int reg,
227227

228228
buf = kmalloc(len + 1, GFP_KERNEL);
229229
if (buf == NULL) {
230-
printk("Unable to kmalloc\n");
231230
ret = -ENOMEM;
232231
goto error;
233232
}
@@ -1127,7 +1126,7 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config,
11271126
dprintk("%s\n", __func__);
11281127

11291128
/* allocate memory for the internal state */
1130-
state = kzalloc(sizeof(struct cx24116_state), GFP_KERNEL);
1129+
state = kzalloc(sizeof(*state), GFP_KERNEL);
11311130
if (state == NULL)
11321131
goto error1;
11331132

drivers/media/dvb-frontends/drxd_hard.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static int WriteTable(struct drxd_state *state, u8 * pTable)
328328
{
329329
int status = 0;
330330

331-
if (pTable == NULL)
331+
if (!pTable)
332332
return 0;
333333

334334
while (!status) {
@@ -909,9 +909,8 @@ static int load_firmware(struct drxd_state *state, const char *fw_name)
909909
}
910910

911911
state->microcode = kmemdup(fw->data, fw->size, GFP_KERNEL);
912-
if (state->microcode == NULL) {
912+
if (!state->microcode) {
913913
release_firmware(fw);
914-
printk(KERN_ERR "drxd: firmware load failure: no memory\n");
915914
return -ENOMEM;
916915
}
917916

@@ -2630,7 +2629,7 @@ static int DRXD_init(struct drxd_state *state, const u8 *fw, u32 fw_size)
26302629
break;
26312630

26322631
/* Apply I2c address patch to B1 */
2633-
if (!state->type_A && state->m_HiI2cPatch != NULL) {
2632+
if (!state->type_A && state->m_HiI2cPatch) {
26342633
status = WriteTable(state, state->m_HiI2cPatch);
26352634
if (status < 0)
26362635
break;

drivers/media/dvb-frontends/ds3000.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,8 @@ static int ds3000_writeFW(struct ds3000_state *state, int reg,
277277
u8 *buf;
278278

279279
buf = kmalloc(33, GFP_KERNEL);
280-
if (buf == NULL) {
281-
printk(KERN_ERR "Unable to kmalloc\n");
280+
if (!buf)
282281
return -ENOMEM;
283-
}
284282

285283
*(buf) = reg;
286284

@@ -841,11 +839,9 @@ struct dvb_frontend *ds3000_attach(const struct ds3000_config *config,
841839
dprintk("%s\n", __func__);
842840

843841
/* allocate memory for the internal state */
844-
state = kzalloc(sizeof(struct ds3000_state), GFP_KERNEL);
845-
if (state == NULL) {
846-
printk(KERN_ERR "Unable to kmalloc\n");
842+
state = kzalloc(sizeof(*state), GFP_KERNEL);
843+
if (!state)
847844
goto error2;
848-
}
849845

850846
state->config = config;
851847
state->i2c = i2c;

drivers/media/dvb-frontends/mb86a20s.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,12 +2071,9 @@ struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config,
20712071
dev_dbg(&i2c->dev, "%s called.\n", __func__);
20722072

20732073
/* allocate memory for the internal state */
2074-
state = kzalloc(sizeof(struct mb86a20s_state), GFP_KERNEL);
2075-
if (state == NULL) {
2076-
dev_err(&i2c->dev,
2077-
"%s: unable to allocate memory for state\n", __func__);
2074+
state = kzalloc(sizeof(*state), GFP_KERNEL);
2075+
if (!state)
20782076
goto error;
2079-
}
20802077

20812078
/* setup the state */
20822079
state->config = config;

drivers/media/dvb-frontends/si2168.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,6 @@ static int si2168_probe(struct i2c_client *client,
699699
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
700700
if (!dev) {
701701
ret = -ENOMEM;
702-
dev_err(&client->dev, "kzalloc() failed\n");
703702
goto err;
704703
}
705704

drivers/media/dvb-frontends/sp2.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,14 @@ static int sp2_exit(struct i2c_client *client)
357357

358358
dev_dbg(&client->dev, "\n");
359359

360-
if (client == NULL)
360+
if (!client)
361361
return 0;
362362

363363
s = i2c_get_clientdata(client);
364-
if (s == NULL)
364+
if (!s)
365365
return 0;
366366

367-
if (s->ca.data == NULL)
367+
if (!s->ca.data)
368368
return 0;
369369

370370
dvb_ca_en50221_release(&s->ca);
@@ -381,10 +381,9 @@ static int sp2_probe(struct i2c_client *client,
381381

382382
dev_dbg(&client->dev, "\n");
383383

384-
s = kzalloc(sizeof(struct sp2), GFP_KERNEL);
384+
s = kzalloc(sizeof(*s), GFP_KERNEL);
385385
if (!s) {
386386
ret = -ENOMEM;
387-
dev_err(&client->dev, "kzalloc() failed\n");
388387
goto err;
389388
}
390389

0 commit comments

Comments
 (0)