Skip to contentSkip to conversation

drivers/hsi/controllers/omap_ssi_port.c:1121:13: warning: the comparison will always evaluate as 'true' for the address of 'port' will never be NULL

PATCH kernel test robot 1 participant 1 message Mar 20

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi.git for-next
head:   e61af3ca893363838f263f3528476f6e1faed9aa
commit: e61af3ca893363838f263f3528476f6e1faed9aa [1/1] hsi: hsi_core: use kzalloc_flex
config: arm-randconfig-003-20260320 (https://download.01.org/0day-ci/archive/20260321/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260321/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/hsi/controllers/omap_ssi_port.c: In function 'ssi_setup':
drivers/hsi/controllers/omap_ssi_port.c:455:13: warning: variable 'val' set but not used [-Wunused-but-set-variable]

     455 |         u32 val;
         |             ^~~
   drivers/hsi/controllers/omap_ssi_port.c: In function 'ssi_port_probe':
>> drivers/hsi/controllers/omap_ssi_port.c:1121:13: warning: the comparison will always evaluate as 'true' for the address of 'port' will never be NULL [-Waddress]
    1121 |         if (!ssi->port || !omap_ssi->port) {
         |             ^
   In file included from drivers/hsi/controllers/omap_ssi.h:16,
                    from drivers/hsi/controllers/omap_ssi_port.c:21:
   include/linux/hsi/hsi.h:274:34: note: 'port' declared here
     274 |         struct hsi_port         *port[] __counted_by(num_ports);
         |                                  ^~~~
   drivers/hsi/controllers/omap_ssi_port.c: In function 'ssi_restore_port_mode':
   drivers/hsi/controllers/omap_ssi_port.c:1302:13: warning: variable 'mode' set but not used [-Wunused-but-set-variable]
    1302 |         u32 mode;
         |             ^~~~

vim +1121 drivers/hsi/controllers/omap_ssi_port.c

b209e047bc7432 Sebastian Reichel 2013-12-15  1107  
0845e1f20af100 Sebastian Reichel 2016-04-30  1108  static int ssi_port_probe(struct platform_device *pd)
b209e047bc7432 Sebastian Reichel 2013-12-15  1109  {
b209e047bc7432 Sebastian Reichel 2013-12-15  1110  	struct device_node *np = pd->dev.of_node;
b209e047bc7432 Sebastian Reichel 2013-12-15  1111  	struct hsi_port *port;
b209e047bc7432 Sebastian Reichel 2013-12-15  1112  	struct omap_ssi_port *omap_port;
b209e047bc7432 Sebastian Reichel 2013-12-15  1113  	struct hsi_controller *ssi = dev_get_drvdata(pd->dev.parent);
b209e047bc7432 Sebastian Reichel 2013-12-15  1114  	struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
73e6ce09c068d4 Sebastian Reichel 2016-04-30  1115  	struct gpio_desc *cawake_gpio = NULL;
b209e047bc7432 Sebastian Reichel 2013-12-15  1116  	u32 port_id;
b209e047bc7432 Sebastian Reichel 2013-12-15  1117  	int err;
b209e047bc7432 Sebastian Reichel 2013-12-15  1118  
b209e047bc7432 Sebastian Reichel 2013-12-15  1119  	dev_dbg(&pd->dev, "init ssi port...\n");
b209e047bc7432 Sebastian Reichel 2013-12-15  1120  
b209e047bc7432 Sebastian Reichel 2013-12-15 @1121  	if (!ssi->port || !omap_ssi->port) {
b209e047bc7432 Sebastian Reichel 2013-12-15  1122  		dev_err(&pd->dev, "ssi controller not initialized!\n");
b209e047bc7432 Sebastian Reichel 2013-12-15  1123  		err = -ENODEV;
b209e047bc7432 Sebastian Reichel 2013-12-15  1124  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1125  	}
b209e047bc7432 Sebastian Reichel 2013-12-15  1126  
b209e047bc7432 Sebastian Reichel 2013-12-15  1127  	/* get id of first uninitialized port in controller */
b209e047bc7432 Sebastian Reichel 2013-12-15  1128  	for (port_id = 0; port_id < ssi->num_ports && omap_ssi->port[port_id];
b209e047bc7432 Sebastian Reichel 2013-12-15  1129  		port_id++)
b209e047bc7432 Sebastian Reichel 2013-12-15  1130  		;
b209e047bc7432 Sebastian Reichel 2013-12-15  1131  
b209e047bc7432 Sebastian Reichel 2013-12-15  1132  	if (port_id >= ssi->num_ports) {
b209e047bc7432 Sebastian Reichel 2013-12-15  1133  		dev_err(&pd->dev, "port id out of range!\n");
b209e047bc7432 Sebastian Reichel 2013-12-15  1134  		err = -ENODEV;
b209e047bc7432 Sebastian Reichel 2013-12-15  1135  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1136  	}
b209e047bc7432 Sebastian Reichel 2013-12-15  1137  
b209e047bc7432 Sebastian Reichel 2013-12-15  1138  	port = ssi->port[port_id];
b209e047bc7432 Sebastian Reichel 2013-12-15  1139  
b209e047bc7432 Sebastian Reichel 2013-12-15  1140  	if (!np) {
b209e047bc7432 Sebastian Reichel 2013-12-15  1141  		dev_err(&pd->dev, "missing device tree data\n");
b209e047bc7432 Sebastian Reichel 2013-12-15  1142  		err = -EINVAL;
b209e047bc7432 Sebastian Reichel 2013-12-15  1143  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1144  	}
b209e047bc7432 Sebastian Reichel 2013-12-15  1145  
73e6ce09c068d4 Sebastian Reichel 2016-04-30  1146  	cawake_gpio = devm_gpiod_get(&pd->dev, "ti,ssi-cawake", GPIOD_IN);
73e6ce09c068d4 Sebastian Reichel 2016-04-30  1147  	if (IS_ERR(cawake_gpio)) {
73e6ce09c068d4 Sebastian Reichel 2016-04-30  1148  		err = PTR_ERR(cawake_gpio);
73e6ce09c068d4 Sebastian Reichel 2016-04-30  1149  		dev_err(&pd->dev, "couldn't get cawake gpio (err=%d)!\n", err);
b209e047bc7432 Sebastian Reichel 2013-12-15  1150  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1151  	}
b209e047bc7432 Sebastian Reichel 2013-12-15  1152  
b209e047bc7432 Sebastian Reichel 2013-12-15  1153  	omap_port = devm_kzalloc(&port->device, sizeof(*omap_port), GFP_KERNEL);
b209e047bc7432 Sebastian Reichel 2013-12-15  1154  	if (!omap_port) {
b209e047bc7432 Sebastian Reichel 2013-12-15  1155  		err = -ENOMEM;
b209e047bc7432 Sebastian Reichel 2013-12-15  1156  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1157  	}
b209e047bc7432 Sebastian Reichel 2013-12-15  1158  	omap_port->wake_gpio = cawake_gpio;
b209e047bc7432 Sebastian Reichel 2013-12-15  1159  	omap_port->pdev = &pd->dev;
b209e047bc7432 Sebastian Reichel 2013-12-15  1160  	omap_port->port_id = port_id;
b209e047bc7432 Sebastian Reichel 2013-12-15  1161  
4e552310cdf0c8 Sebastian Reichel 2016-05-20  1162  	INIT_DEFERRABLE_WORK(&omap_port->errqueue_work, ssi_process_errqueue);
7c5d81620ecd37 Sebastian Reichel 2016-05-11  1163  	INIT_WORK(&omap_port->work, start_tx_work);
7c5d81620ecd37 Sebastian Reichel 2016-05-11  1164  
b209e047bc7432 Sebastian Reichel 2013-12-15  1165  	/* initialize HSI port */
b209e047bc7432 Sebastian Reichel 2013-12-15  1166  	port->async	= ssi_async;
b209e047bc7432 Sebastian Reichel 2013-12-15  1167  	port->setup	= ssi_setup;
b209e047bc7432 Sebastian Reichel 2013-12-15  1168  	port->flush	= ssi_flush;
b209e047bc7432 Sebastian Reichel 2013-12-15  1169  	port->start_tx	= ssi_start_tx;
b209e047bc7432 Sebastian Reichel 2013-12-15  1170  	port->stop_tx	= ssi_stop_tx;
b209e047bc7432 Sebastian Reichel 2013-12-15  1171  	port->release	= ssi_release;
b209e047bc7432 Sebastian Reichel 2013-12-15  1172  	hsi_port_set_drvdata(port, omap_port);
b209e047bc7432 Sebastian Reichel 2013-12-15  1173  	omap_ssi->port[port_id] = omap_port;
b209e047bc7432 Sebastian Reichel 2013-12-15  1174  
b209e047bc7432 Sebastian Reichel 2013-12-15  1175  	platform_set_drvdata(pd, port);
b209e047bc7432 Sebastian Reichel 2013-12-15  1176  
b209e047bc7432 Sebastian Reichel 2013-12-15  1177  	err = ssi_port_get_iomem(pd, "tx", &omap_port->sst_base,
b209e047bc7432 Sebastian Reichel 2013-12-15  1178  		&omap_port->sst_dma);
b209e047bc7432 Sebastian Reichel 2013-12-15  1179  	if (err < 0)
b209e047bc7432 Sebastian Reichel 2013-12-15  1180  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1181  	err = ssi_port_get_iomem(pd, "rx", &omap_port->ssr_base,
b209e047bc7432 Sebastian Reichel 2013-12-15  1182  		&omap_port->ssr_dma);
b209e047bc7432 Sebastian Reichel 2013-12-15  1183  	if (err < 0)
b209e047bc7432 Sebastian Reichel 2013-12-15  1184  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1185  
b209e047bc7432 Sebastian Reichel 2013-12-15  1186  	err = ssi_port_irq(port, pd);
b209e047bc7432 Sebastian Reichel 2013-12-15  1187  	if (err < 0)
b209e047bc7432 Sebastian Reichel 2013-12-15  1188  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1189  	err = ssi_wake_irq(port, pd);
b209e047bc7432 Sebastian Reichel 2013-12-15  1190  	if (err < 0)
b209e047bc7432 Sebastian Reichel 2013-12-15  1191  		goto error;
b209e047bc7432 Sebastian Reichel 2013-12-15  1192  
b209e047bc7432 Sebastian Reichel 2013-12-15  1193  	ssi_queues_init(omap_port);
b209e047bc7432 Sebastian Reichel 2013-12-15  1194  	spin_lock_init(&omap_port->lock);
b209e047bc7432 Sebastian Reichel 2013-12-15  1195  	spin_lock_init(&omap_port->wk_lock);
b209e047bc7432 Sebastian Reichel 2013-12-15  1196  	omap_port->dev = &port->device;
b209e047bc7432 Sebastian Reichel 2013-12-15  1197  
ad60db2f9fe336 Sebastian Reichel 2016-05-11  1198  	pm_runtime_use_autosuspend(omap_port->pdev);
ad60db2f9fe336 Sebastian Reichel 2016-05-11  1199  	pm_runtime_set_autosuspend_delay(omap_port->pdev, 250);
b209e047bc7432 Sebastian Reichel 2013-12-15  1200  	pm_runtime_enable(omap_port->pdev);
b209e047bc7432 Sebastian Reichel 2013-12-15  1201  

:::::: The code at line 1121 was first introduced by commit :::::: b209e047bc743247f74ce79e8827ae1ed556bae0 HSI: Introduce OMAP SSI driver

:::::: TO: Sebastian Reichel <[email protected]>
:::::: CC: Sebastian Reichel <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki