A number of drivers were comparing request_region() with 0,
others were passing 0 instead of NULL as a pointer argument.
This led to the following sparse warning, for example:
cb7210/cb7210.c:1043:72: warning: Using plain integer as NULL pointer
Use !request_region() to test for NULL return and use NULL instead
of 0 as pointer parameter.
Signed-off-by: Dave Penkler <dpenkler@gmail.com>
Link: https://lore.kernel.org/r/20250114165403.16410-4-dpenkler@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
return retval;
cb_priv = board->private_data;
nec_priv = &cb_priv->nec7210_priv;
- if (request_region(config->ibbase, cb7210_iosize, "cb7210") == 0) {
+ if (!request_region(config->ibbase, cb7210_iosize, "cb7210")) {
pr_err("gpib: ioports starting at 0x%u are already in use\n", config->ibbase);
return -EIO;
}
cb_priv = board->private_data;
nec_priv = &cb_priv->nec7210_priv;
- if (request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]),
- "cb7210") == 0) {
+ if (!request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]),
+ "cb7210")) {
pr_err("gpib: ioports starting at 0x%lx are already in use\n",
(unsigned long)curr_dev->resource[0]->start);
return -EIO;
return PTR_ERR(gpib_class);
}
for (i = 0; i < GPIB_MAX_NUM_BOARDS; ++i)
- board_array[i].gpib_dev = device_create(gpib_class, 0,
+ board_array[i].gpib_dev = device_create(gpib_class, NULL,
MKDEV(GPIB_CODE, i), NULL, "gpib%i", i);
return 0;
/* make sure we only clear status bits that we are reporting */
if (*status & clear_mask || set_mask)
- general_ibstatus(board, status_queue, *status & clear_mask, set_mask, 0);
+ general_ibstatus(board, status_queue, *status & clear_mask, set_mask, NULL);
return 0;
}
static struct gpiod_lookup_table *lookup_tables[] = {
&gpib_gpio_table_0,
&gpib_gpio_table_1,
- 0
+ NULL
};
/* struct which defines private_data for gpio driver */
for (j = 0 ; j < NUM_PINS ; j++) {
if (all_descriptors[j]) {
gpiod_put(all_descriptors[j]);
- all_descriptors[j] = 0;
+ all_descriptors[j] = NULL;
}
}
}
ines_priv = board->private_data;
nec_priv = &ines_priv->nec7210_priv;
- if (request_region(curr_dev->resource[0]->start,
- resource_size(curr_dev->resource[0]), "ines_gpib") == 0) {
+ if (!request_region(curr_dev->resource[0]->start,
+ resource_size(curr_dev->resource[0]), "ines_gpib")) {
pr_err("ines_gpib: ioports at 0x%lx already in use\n",
(unsigned long)(curr_dev->resource[0]->start));
return -1;
nec_priv = &pc2_priv->nec7210_priv;
nec_priv->offset = pc2_reg_offset;
- if (request_region(config->ibbase, pc2_iosize, "pc2") == 0) {
+ if (!request_region(config->ibbase, pc2_iosize, "pc2")) {
pr_err("gpib: ioports are already in use\n");
return -1;
}
nec_priv->offset = atgpib_reg_offset;
DEBUG(0, "ioport1 window attributes: 0x%lx\n", curr_dev->resource[0]->flags);
- if (request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]),
- "tnt4882") == 0) {
+ if (!request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]),
+ "tnt4882")) {
pr_err("gpib: ioports starting at 0x%lx are already in use\n",
(unsigned long)curr_dev->resource[0]->start);
return -EIO;