Commit 28b671b4 authored by Ricardo Silva's avatar Ricardo Silva Committed by Mauro Carvalho Chehab

[media] lirc_zilog: Fix NULL comparisons style

Fix all checkpatch reported issues for "CHECK: Comparison to NULL could
be written...".

Do these comparisons using the recommended coding style and consistent
with other similar cases in the file, which already used the recommended
way.
Signed-off-by: default avatarRicardo Silva <rjpdasilva@gmail.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 32ddcbb5
...@@ -215,7 +215,7 @@ static struct IR_rx *get_ir_rx(struct IR *ir) ...@@ -215,7 +215,7 @@ static struct IR_rx *get_ir_rx(struct IR *ir)
spin_lock(&ir->rx_ref_lock); spin_lock(&ir->rx_ref_lock);
rx = ir->rx; rx = ir->rx;
if (rx != NULL) if (rx)
kref_get(&rx->ref); kref_get(&rx->ref);
spin_unlock(&ir->rx_ref_lock); spin_unlock(&ir->rx_ref_lock);
return rx; return rx;
...@@ -277,7 +277,7 @@ static struct IR_tx *get_ir_tx(struct IR *ir) ...@@ -277,7 +277,7 @@ static struct IR_tx *get_ir_tx(struct IR *ir)
spin_lock(&ir->tx_ref_lock); spin_lock(&ir->tx_ref_lock);
tx = ir->tx; tx = ir->tx;
if (tx != NULL) if (tx)
kref_get(&tx->ref); kref_get(&tx->ref);
spin_unlock(&ir->tx_ref_lock); spin_unlock(&ir->tx_ref_lock);
return tx; return tx;
...@@ -327,12 +327,12 @@ static int add_to_buf(struct IR *ir) ...@@ -327,12 +327,12 @@ static int add_to_buf(struct IR *ir)
} }
rx = get_ir_rx(ir); rx = get_ir_rx(ir);
if (rx == NULL) if (!rx)
return -ENXIO; return -ENXIO;
/* Ensure our rx->c i2c_client remains valid for the duration */ /* Ensure our rx->c i2c_client remains valid for the duration */
mutex_lock(&rx->client_lock); mutex_lock(&rx->client_lock);
if (rx->c == NULL) { if (!rx->c) {
mutex_unlock(&rx->client_lock); mutex_unlock(&rx->client_lock);
put_ir_rx(rx, false); put_ir_rx(rx, false);
return -ENXIO; return -ENXIO;
...@@ -388,7 +388,7 @@ static int add_to_buf(struct IR *ir) ...@@ -388,7 +388,7 @@ static int add_to_buf(struct IR *ir)
break; break;
} }
schedule_timeout((100 * HZ + 999) / 1000); schedule_timeout((100 * HZ + 999) / 1000);
if (tx != NULL) if (tx)
tx->need_boot = 1; tx->need_boot = 1;
++failures; ++failures;
...@@ -444,7 +444,7 @@ static int add_to_buf(struct IR *ir) ...@@ -444,7 +444,7 @@ static int add_to_buf(struct IR *ir)
} while (!lirc_buffer_full(rbuf)); } while (!lirc_buffer_full(rbuf));
mutex_unlock(&rx->client_lock); mutex_unlock(&rx->client_lock);
if (tx != NULL) if (tx)
put_ir_tx(tx, false); put_ir_tx(tx, false);
put_ir_rx(rx, false); put_ir_rx(rx, false);
return ret; return ret;
...@@ -763,7 +763,7 @@ static int fw_load(struct IR_tx *tx) ...@@ -763,7 +763,7 @@ static int fw_load(struct IR_tx *tx)
/* Parse the file */ /* Parse the file */
tx_data = vmalloc(sizeof(*tx_data)); tx_data = vmalloc(sizeof(*tx_data));
if (tx_data == NULL) { if (!tx_data) {
release_firmware(fw_entry); release_firmware(fw_entry);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
...@@ -772,7 +772,7 @@ static int fw_load(struct IR_tx *tx) ...@@ -772,7 +772,7 @@ static int fw_load(struct IR_tx *tx)
/* Copy the data so hotplug doesn't get confused and timeout */ /* Copy the data so hotplug doesn't get confused and timeout */
tx_data->datap = vmalloc(fw_entry->size); tx_data->datap = vmalloc(fw_entry->size);
if (tx_data->datap == NULL) { if (!tx_data->datap) {
release_firmware(fw_entry); release_firmware(fw_entry);
vfree(tx_data); vfree(tx_data);
ret = -ENOMEM; ret = -ENOMEM;
...@@ -809,7 +809,7 @@ static int fw_load(struct IR_tx *tx) ...@@ -809,7 +809,7 @@ static int fw_load(struct IR_tx *tx)
tx_data->code_sets = vmalloc( tx_data->code_sets = vmalloc(
tx_data->num_code_sets * sizeof(char *)); tx_data->num_code_sets * sizeof(char *));
if (tx_data->code_sets == NULL) { if (!tx_data->code_sets) {
fw_unload_locked(); fw_unload_locked();
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
...@@ -896,7 +896,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, ...@@ -896,7 +896,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n,
} }
rx = get_ir_rx(ir); rx = get_ir_rx(ir);
if (rx == NULL) if (!rx)
return -ENXIO; return -ENXIO;
/* /*
...@@ -1102,12 +1102,12 @@ static ssize_t write(struct file *filep, const char __user *buf, size_t n, ...@@ -1102,12 +1102,12 @@ static ssize_t write(struct file *filep, const char __user *buf, size_t n,
/* Get a struct IR_tx reference */ /* Get a struct IR_tx reference */
tx = get_ir_tx(ir); tx = get_ir_tx(ir);
if (tx == NULL) if (!tx)
return -ENXIO; return -ENXIO;
/* Ensure our tx->c i2c_client remains valid for the duration */ /* Ensure our tx->c i2c_client remains valid for the duration */
mutex_lock(&tx->client_lock); mutex_lock(&tx->client_lock);
if (tx->c == NULL) { if (!tx->c) {
mutex_unlock(&tx->client_lock); mutex_unlock(&tx->client_lock);
put_ir_tx(tx, false); put_ir_tx(tx, false);
return -ENXIO; return -ENXIO;
...@@ -1206,7 +1206,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) ...@@ -1206,7 +1206,7 @@ static unsigned int poll(struct file *filep, poll_table *wait)
dev_dbg(ir->l.dev, "poll called\n"); dev_dbg(ir->l.dev, "poll called\n");
rx = get_ir_rx(ir); rx = get_ir_rx(ir);
if (rx == NULL) { if (!rx) {
/* /*
* Revisit this, if our poll function ever reports writeable * Revisit this, if our poll function ever reports writeable
* status for Tx * status for Tx
...@@ -1313,7 +1313,7 @@ static int open(struct inode *node, struct file *filep) ...@@ -1313,7 +1313,7 @@ static int open(struct inode *node, struct file *filep)
/* find our IR struct */ /* find our IR struct */
ir = get_ir_device_by_minor(minor); ir = get_ir_device_by_minor(minor);
if (ir == NULL) if (!ir)
return -ENODEV; return -ENODEV;
atomic_inc(&ir->open_count); atomic_inc(&ir->open_count);
...@@ -1331,7 +1331,7 @@ static int close(struct inode *node, struct file *filep) ...@@ -1331,7 +1331,7 @@ static int close(struct inode *node, struct file *filep)
/* find our IR struct */ /* find our IR struct */
struct IR *ir = filep->private_data; struct IR *ir = filep->private_data;
if (ir == NULL) { if (!ir) {
pr_err("ir: close: no private_data attached to the file!\n"); pr_err("ir: close: no private_data attached to the file!\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1395,7 +1395,7 @@ static int ir_remove(struct i2c_client *client) ...@@ -1395,7 +1395,7 @@ static int ir_remove(struct i2c_client *client)
if (strncmp("ir_tx_z8", client->name, 8) == 0) { if (strncmp("ir_tx_z8", client->name, 8) == 0) {
struct IR_tx *tx = i2c_get_clientdata(client); struct IR_tx *tx = i2c_get_clientdata(client);
if (tx != NULL) { if (tx) {
mutex_lock(&tx->client_lock); mutex_lock(&tx->client_lock);
tx->c = NULL; tx->c = NULL;
mutex_unlock(&tx->client_lock); mutex_unlock(&tx->client_lock);
...@@ -1404,7 +1404,7 @@ static int ir_remove(struct i2c_client *client) ...@@ -1404,7 +1404,7 @@ static int ir_remove(struct i2c_client *client)
} else if (strncmp("ir_rx_z8", client->name, 8) == 0) { } else if (strncmp("ir_rx_z8", client->name, 8) == 0) {
struct IR_rx *rx = i2c_get_clientdata(client); struct IR_rx *rx = i2c_get_clientdata(client);
if (rx != NULL) { if (rx) {
mutex_lock(&rx->client_lock); mutex_lock(&rx->client_lock);
rx->c = NULL; rx->c = NULL;
mutex_unlock(&rx->client_lock); mutex_unlock(&rx->client_lock);
...@@ -1460,7 +1460,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1460,7 +1460,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
/* Use a single struct IR instance for both the Rx and Tx functions */ /* Use a single struct IR instance for both the Rx and Tx functions */
ir = get_ir_device_by_adapter(adap); ir = get_ir_device_by_adapter(adap);
if (ir == NULL) { if (!ir) {
ir = kzalloc(sizeof(struct IR), GFP_KERNEL); ir = kzalloc(sizeof(struct IR), GFP_KERNEL);
if (!ir) { if (!ir) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -1534,7 +1534,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1534,7 +1534,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
fw_load(tx); fw_load(tx);
/* Proceed only if the Rx client is also ready or not needed */ /* Proceed only if the Rx client is also ready or not needed */
if (rx == NULL && !tx_only) { if (!rx && !tx_only) {
dev_info(tx->ir->l.dev, dev_info(tx->ir->l.dev,
"probe of IR Tx on %s (i2c-%d) done. Waiting on IR Rx.\n", "probe of IR Tx on %s (i2c-%d) done. Waiting on IR Rx.\n",
adap->name, adap->nr); adap->name, adap->nr);
...@@ -1588,7 +1588,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1588,7 +1588,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
} }
/* Proceed only if the Tx client is also ready */ /* Proceed only if the Tx client is also ready */
if (tx == NULL) { if (!tx) {
pr_info("probe of IR Rx on %s (i2c-%d) done. Waiting on IR Tx.\n", pr_info("probe of IR Rx on %s (i2c-%d) done. Waiting on IR Tx.\n",
adap->name, adap->nr); adap->name, adap->nr);
goto out_ok; goto out_ok;
...@@ -1609,9 +1609,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1609,9 +1609,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
adap->name, adap->nr, ir->l.minor); adap->name, adap->nr, ir->l.minor);
out_ok: out_ok:
if (rx != NULL) if (rx)
put_ir_rx(rx, true); put_ir_rx(rx, true);
if (tx != NULL) if (tx)
put_ir_tx(tx, true); put_ir_tx(tx, true);
put_ir_device(ir, true); put_ir_device(ir, true);
dev_info(ir->l.dev, dev_info(ir->l.dev,
...@@ -1621,10 +1621,10 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1621,10 +1621,10 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
return 0; return 0;
out_put_xx: out_put_xx:
if (rx != NULL) if (rx)
put_ir_rx(rx, true); put_ir_rx(rx, true);
out_put_tx: out_put_tx:
if (tx != NULL) if (tx)
put_ir_tx(tx, true); put_ir_tx(tx, true);
out_put_ir: out_put_ir:
put_ir_device(ir, true); put_ir_device(ir, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment