Hello Sylwester Nawrocki,
The patch c6bebefa2f06: "ASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization" from Feb 19, 2019 (linux-next), leads to the following Smatch static checker warning:
sound/soc/samsung/i2s.c:1381 i2s_create_secondary_device() info: return a literal instead of 'ret'
sound/soc/samsung/i2s.c 1350 static int i2s_create_secondary_device(struct samsung_i2s_priv *priv) 1351 { 1352 struct platform_device *pdev_sec; 1353 const char *devname; 1354 int ret; 1355 1356 devname = devm_kasprintf(&priv->pdev->dev, GFP_KERNEL, "%s-sec", 1357 dev_name(&priv->pdev->dev)); 1358 if (!devname) 1359 return -ENOMEM; 1360 1361 pdev_sec = platform_device_alloc(devname, -1); 1362 if (!pdev_sec) 1363 return -ENOMEM; 1364 1365 pdev_sec->driver_override = kstrdup("samsung-i2s", GFP_KERNEL); 1366 if (!pdev_sec->driver_override) { 1367 platform_device_put(pdev_sec); 1368 return -ENOMEM; 1369 } 1370 1371 ret = platform_device_add(pdev_sec); 1372 if (ret < 0) { 1373 platform_device_put(pdev_sec); 1374 return ret; 1375 } 1376 1377 ret = device_attach(&pdev_sec->dev); 1378 if (ret <= 0) {
Huh. I'm not sure how device_attach() is supposed to be handled. Here are the return values.
* Returns 1 if the device was bound to a driver; * 0 if no matching driver was found; * -ENODEV if the device is not registered.
1379 platform_device_unregister(priv->pdev_sec); 1380 dev_info(&pdev_sec->dev, "device_attach() failed\n"); --> 1381 return ret;
So in this case we printing that "device_attach() failed\n" but we're returning success to the caller. It might be correct, but if so then it should have a comment.
1382 } 1383 1384 priv->pdev_sec = pdev_sec; 1385 1386 return 0; 1387 }
regards, dan carpenter