Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: inkern: fix coding style warnings

Just cosmetics. No functional change intended...

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-16-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Nuno Sá and committed by
Jonathan Cameron
110f1158 b22bc4d6

+32 -32
+32 -32
drivers/iio/inkern.c
··· 45 45 int i = 0, ret = 0; 46 46 struct iio_map_internal *mapi; 47 47 48 - if (maps == NULL) 48 + if (!maps) 49 49 return 0; 50 50 51 51 mutex_lock(&iio_map_list_lock); 52 - while (maps[i].consumer_dev_name != NULL) { 52 + while (maps[i].consumer_dev_name) { 53 53 mapi = kzalloc(sizeof(*mapi), GFP_KERNEL); 54 - if (mapi == NULL) { 54 + if (!mapi) { 55 55 ret = -ENOMEM; 56 56 goto error_ret; 57 57 } ··· 68 68 return ret; 69 69 } 70 70 EXPORT_SYMBOL_GPL(iio_map_array_register); 71 - 72 71 73 72 /* 74 73 * Remove all map entries associated with the given iio device ··· 156 157 return err; 157 158 158 159 idev = bus_find_device_by_fwnode(&iio_bus_type, iiospec.fwnode); 159 - if (idev == NULL) { 160 + if (!idev) { 160 161 fwnode_handle_put(iiospec.fwnode); 161 162 return -EPROBE_DEFER; 162 163 } ··· 189 190 return ERR_PTR(-EINVAL); 190 191 191 192 channel = kzalloc(sizeof(*channel), GFP_KERNEL); 192 - if (channel == NULL) 193 + if (!channel) 193 194 return ERR_PTR(-ENOMEM); 194 195 195 196 err = __fwnode_iio_channel_get(channel, fwnode, index); ··· 307 308 308 309 /* NULL terminated array to save passing size */ 309 310 chans = kcalloc(nummaps + 1, sizeof(*chans), GFP_KERNEL); 310 - if (chans == NULL) 311 + if (!chans) 311 312 return ERR_PTR(-ENOMEM); 312 313 313 314 /* Search for FW matches */ ··· 332 333 struct iio_channel *channel; 333 334 int err; 334 335 335 - if (name == NULL && channel_name == NULL) 336 + if (!(name || channel_name)) 336 337 return ERR_PTR(-ENODEV); 337 338 338 339 /* first find matching entry the channel map */ ··· 347 348 break; 348 349 } 349 350 mutex_unlock(&iio_map_list_lock); 350 - if (c == NULL) 351 + if (!c) 351 352 return ERR_PTR(-ENODEV); 352 353 353 354 channel = kzalloc(sizeof(*channel), GFP_KERNEL); 354 - if (channel == NULL) { 355 + if (!channel) { 355 356 err = -ENOMEM; 356 357 goto error_no_mem; 357 358 } ··· 363 364 iio_chan_spec_from_name(channel->indio_dev, 364 365 c->map->adc_channel_label); 365 366 366 - if (channel->channel == NULL) { 367 + if (!channel->channel) { 367 368 err = -EINVAL; 368 369 goto error_no_chan; 369 370 } ··· 455 456 int mapind = 0; 456 457 int i, ret; 457 458 458 - if (dev == NULL) 459 + if (!dev) 459 460 return ERR_PTR(-EINVAL); 460 461 461 462 chans = fwnode_iio_channel_get_all(dev); ··· 483 484 484 485 /* NULL terminated array to save passing size */ 485 486 chans = kcalloc(nummaps + 1, sizeof(*chans), GFP_KERNEL); 486 - if (chans == NULL) { 487 + if (!chans) { 487 488 ret = -ENOMEM; 488 489 goto error_ret; 489 490 } ··· 497 498 chans[mapind].channel = 498 499 iio_chan_spec_from_name(chans[mapind].indio_dev, 499 500 c->map->adc_channel_label); 500 - if (chans[mapind].channel == NULL) { 501 + if (!chans[mapind].channel) { 501 502 ret = -EINVAL; 502 503 goto error_free_chans; 503 504 } ··· 559 560 EXPORT_SYMBOL_GPL(devm_iio_channel_get_all); 560 561 561 562 static int iio_channel_read(struct iio_channel *chan, int *val, int *val2, 562 - enum iio_chan_info_enum info) 563 + enum iio_chan_info_enum info) 563 564 { 564 565 int unused; 565 566 int vals[INDIO_MAX_RAW_ELEMENTS]; 566 567 int ret; 567 568 int val_len = 2; 568 569 569 - if (val2 == NULL) 570 + if (!val2) 570 571 val2 = &unused; 571 572 572 573 if (!iio_channel_has_info(chan->channel, info)) ··· 578 579 vals, &val_len, info); 579 580 *val = vals[0]; 580 581 *val2 = vals[1]; 581 - } else 582 + } else { 582 583 ret = chan->indio_dev->info->read_raw(chan->indio_dev, 583 584 chan->channel, val, val2, info); 585 + } 584 586 585 587 return ret; 586 588 } ··· 592 592 int ret; 593 593 594 594 mutex_lock(&iio_dev_opaque->info_exist_lock); 595 - if (chan->indio_dev->info == NULL) { 595 + if (!chan->indio_dev->info) { 596 596 ret = -ENODEV; 597 597 goto err_unlock; 598 598 } ··· 611 611 int ret; 612 612 613 613 mutex_lock(&iio_dev_opaque->info_exist_lock); 614 - if (chan->indio_dev->info == NULL) { 614 + if (!chan->indio_dev->info) { 615 615 ret = -ENODEV; 616 616 goto err_unlock; 617 617 } ··· 625 625 EXPORT_SYMBOL_GPL(iio_read_channel_average_raw); 626 626 627 627 static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, 628 - int raw, int *processed, unsigned int scale) 628 + int raw, int *processed, 629 + unsigned int scale) 629 630 { 630 631 int scale_type, scale_val, scale_val2; 631 632 int offset_type, offset_val, offset_val2; ··· 659 658 } 660 659 661 660 scale_type = iio_channel_read(chan, &scale_val, &scale_val2, 662 - IIO_CHAN_INFO_SCALE); 661 + IIO_CHAN_INFO_SCALE); 663 662 if (scale_type < 0) { 664 663 /* 665 664 * If no channel scaling is available apply consumer scale to ··· 704 703 } 705 704 706 705 int iio_convert_raw_to_processed(struct iio_channel *chan, int raw, 707 - int *processed, unsigned int scale) 706 + int *processed, unsigned int scale) 708 707 { 709 708 struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(chan->indio_dev); 710 709 int ret; 711 710 712 711 mutex_lock(&iio_dev_opaque->info_exist_lock); 713 - if (chan->indio_dev->info == NULL) { 712 + if (!chan->indio_dev->info) { 714 713 ret = -ENODEV; 715 714 goto err_unlock; 716 715 } 717 716 718 717 ret = iio_convert_raw_to_processed_unlocked(chan, raw, processed, 719 - scale); 718 + scale); 720 719 err_unlock: 721 720 mutex_unlock(&iio_dev_opaque->info_exist_lock); 722 721 ··· 731 730 int ret; 732 731 733 732 mutex_lock(&iio_dev_opaque->info_exist_lock); 734 - if (chan->indio_dev->info == NULL) { 733 + if (!chan->indio_dev->info) { 735 734 ret = -ENODEV; 736 735 goto err_unlock; 737 736 } ··· 757 756 int ret; 758 757 759 758 mutex_lock(&iio_dev_opaque->info_exist_lock); 760 - if (chan->indio_dev->info == NULL) { 759 + if (!chan->indio_dev->info) { 761 760 ret = -ENODEV; 762 761 goto err_unlock; 763 762 } ··· 835 834 int type; 836 835 837 836 ret = iio_read_avail_channel_attribute(chan, vals, &type, length, 838 - IIO_CHAN_INFO_RAW); 837 + IIO_CHAN_INFO_RAW); 839 838 840 839 if (ret >= 0 && type != IIO_VAL_INT) 841 840 /* raw values are assumed to be IIO_VAL_INT */ ··· 919 918 /* Need to verify underlying driver has not gone away */ 920 919 921 920 mutex_lock(&iio_dev_opaque->info_exist_lock); 922 - if (chan->indio_dev->info == NULL) { 921 + if (!chan->indio_dev->info) { 923 922 ret = -ENODEV; 924 923 goto err_unlock; 925 924 } ··· 946 945 int ret; 947 946 948 947 mutex_lock(&iio_dev_opaque->info_exist_lock); 949 - if (chan->indio_dev->info == NULL) { 948 + if (!chan->indio_dev->info) { 950 949 ret = -ENODEV; 951 950 goto err_unlock; 952 951 } ··· 980 979 } 981 980 EXPORT_SYMBOL_GPL(iio_get_channel_ext_info_count); 982 981 983 - static const struct iio_chan_spec_ext_info *iio_lookup_ext_info( 984 - const struct iio_channel *chan, 985 - const char *attr) 982 + static const struct iio_chan_spec_ext_info * 983 + iio_lookup_ext_info(const struct iio_channel *chan, const char *attr) 986 984 { 987 985 const struct iio_chan_spec_ext_info *ext_info; 988 986