spin_lock(&ir->rx_ref_lock);
rx = ir->rx;
- if (rx != NULL)
+ if (rx)
kref_get(&rx->ref);
spin_unlock(&ir->rx_ref_lock);
return rx;
spin_lock(&ir->tx_ref_lock);
tx = ir->tx;
- if (tx != NULL)
+ if (tx)
kref_get(&tx->ref);
spin_unlock(&ir->tx_ref_lock);
return tx;
}
rx = get_ir_rx(ir);
- if (rx == NULL)
+ if (!rx)
return -ENXIO;
/* Ensure our rx->c i2c_client remains valid for the duration */
mutex_lock(&rx->client_lock);
- if (rx->c == NULL) {
+ if (!rx->c) {
mutex_unlock(&rx->client_lock);
put_ir_rx(rx, false);
return -ENXIO;
break;
}
schedule_timeout((100 * HZ + 999) / 1000);
- if (tx != NULL)
+ if (tx)
tx->need_boot = 1;
++failures;
} while (!lirc_buffer_full(rbuf));
mutex_unlock(&rx->client_lock);
- if (tx != NULL)
+ if (tx)
put_ir_tx(tx, false);
put_ir_rx(rx, false);
return ret;
/* Parse the file */
tx_data = vmalloc(sizeof(*tx_data));
- if (tx_data == NULL) {
+ if (!tx_data) {
release_firmware(fw_entry);
ret = -ENOMEM;
goto out;
/* Copy the data so hotplug doesn't get confused and timeout */
tx_data->datap = vmalloc(fw_entry->size);
- if (tx_data->datap == NULL) {
+ if (!tx_data->datap) {
release_firmware(fw_entry);
vfree(tx_data);
ret = -ENOMEM;
tx_data->code_sets = vmalloc(
tx_data->num_code_sets * sizeof(char *));
- if (tx_data->code_sets == NULL) {
+ if (!tx_data->code_sets) {
fw_unload_locked();
ret = -ENOMEM;
goto out;
}
rx = get_ir_rx(ir);
- if (rx == NULL)
+ if (!rx)
return -ENXIO;
/*
/* Get a struct IR_tx reference */
tx = get_ir_tx(ir);
- if (tx == NULL)
+ if (!tx)
return -ENXIO;
/* Ensure our tx->c i2c_client remains valid for the duration */
mutex_lock(&tx->client_lock);
- if (tx->c == NULL) {
+ if (!tx->c) {
mutex_unlock(&tx->client_lock);
put_ir_tx(tx, false);
return -ENXIO;
dev_dbg(ir->l.dev, "poll called\n");
rx = get_ir_rx(ir);
- if (rx == NULL) {
+ if (!rx) {
/*
* Revisit this, if our poll function ever reports writeable
* status for Tx
/* find our IR struct */
ir = get_ir_device_by_minor(minor);
- if (ir == NULL)
+ if (!ir)
return -ENODEV;
atomic_inc(&ir->open_count);
/* find our IR struct */
struct IR *ir = filep->private_data;
- if (ir == NULL) {
+ if (!ir) {
pr_err("ir: close: no private_data attached to the file!\n");
return -ENODEV;
}
if (strncmp("ir_tx_z8", client->name, 8) == 0) {
struct IR_tx *tx = i2c_get_clientdata(client);
- if (tx != NULL) {
+ if (tx) {
mutex_lock(&tx->client_lock);
tx->c = NULL;
mutex_unlock(&tx->client_lock);
} else if (strncmp("ir_rx_z8", client->name, 8) == 0) {
struct IR_rx *rx = i2c_get_clientdata(client);
- if (rx != NULL) {
+ if (rx) {
mutex_lock(&rx->client_lock);
rx->c = NULL;
mutex_unlock(&rx->client_lock);
/* Use a single struct IR instance for both the Rx and Tx functions */
ir = get_ir_device_by_adapter(adap);
- if (ir == NULL) {
+ if (!ir) {
ir = kzalloc(sizeof(struct IR), GFP_KERNEL);
if (!ir) {
ret = -ENOMEM;
fw_load(tx);
/* 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,
"probe of IR Tx on %s (i2c-%d) done. Waiting on IR Rx.\n",
adap->name, adap->nr);
}
/* 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",
adap->name, adap->nr);
goto out_ok;
adap->name, adap->nr, ir->l.minor);
out_ok:
- if (rx != NULL)
+ if (rx)
put_ir_rx(rx, true);
- if (tx != NULL)
+ if (tx)
put_ir_tx(tx, true);
put_ir_device(ir, true);
dev_info(ir->l.dev,
return 0;
out_put_xx:
- if (rx != NULL)
+ if (rx)
put_ir_rx(rx, true);
out_put_tx:
- if (tx != NULL)
+ if (tx)
put_ir_tx(tx, true);
out_put_ir:
put_ir_device(ir, true);