[kbuild] [linux-next:master 4120/6188] drivers/crypto/aspeed/aspeed-hace.c:133 aspeed_hace_probe() warn: platform_get_irq() does not return zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Herbert,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git   master
head:   47c191411b68a771261be3dc0bd6f68394cef358
commit: 31b39755e32568b43c80814c5e13d7b1ab796d73 [4120/6188] crypto: aspeed - Enable compile testing
config: openrisc-randconfig-m041-20220907
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/crypto/aspeed/aspeed-hace.c:133 aspeed_hace_probe() warn: platform_get_irq() does not return zero

vim +133 drivers/crypto/aspeed/aspeed-hace.c

108713a713c7e4b Neal Liu 2022-08-18   96  static int aspeed_hace_probe(struct platform_device *pdev)
108713a713c7e4b Neal Liu 2022-08-18   97  {
62f58b1637b7c8d Neal Liu 2022-08-18   98  	struct aspeed_engine_crypto *crypto_engine;
108713a713c7e4b Neal Liu 2022-08-18   99  	const struct of_device_id *hace_dev_id;
108713a713c7e4b Neal Liu 2022-08-18  100  	struct aspeed_engine_hash *hash_engine;
108713a713c7e4b Neal Liu 2022-08-18  101  	struct aspeed_hace_dev *hace_dev;
108713a713c7e4b Neal Liu 2022-08-18  102  	struct resource *res;
108713a713c7e4b Neal Liu 2022-08-18  103  	int rc;
108713a713c7e4b Neal Liu 2022-08-18  104  
108713a713c7e4b Neal Liu 2022-08-18  105  	hace_dev = devm_kzalloc(&pdev->dev, sizeof(struct aspeed_hace_dev),
108713a713c7e4b Neal Liu 2022-08-18  106  				GFP_KERNEL);
108713a713c7e4b Neal Liu 2022-08-18  107  	if (!hace_dev)
108713a713c7e4b Neal Liu 2022-08-18  108  		return -ENOMEM;
108713a713c7e4b Neal Liu 2022-08-18  109  
108713a713c7e4b Neal Liu 2022-08-18  110  	hace_dev_id = of_match_device(aspeed_hace_of_matches, &pdev->dev);
108713a713c7e4b Neal Liu 2022-08-18  111  	if (!hace_dev_id) {
108713a713c7e4b Neal Liu 2022-08-18  112  		dev_err(&pdev->dev, "Failed to match hace dev id\n");
108713a713c7e4b Neal Liu 2022-08-18  113  		return -EINVAL;
108713a713c7e4b Neal Liu 2022-08-18  114  	}
108713a713c7e4b Neal Liu 2022-08-18  115  
108713a713c7e4b Neal Liu 2022-08-18  116  	hace_dev->dev = &pdev->dev;
108713a713c7e4b Neal Liu 2022-08-18  117  	hace_dev->version = (unsigned long)hace_dev_id->data;
108713a713c7e4b Neal Liu 2022-08-18  118  	hash_engine = &hace_dev->hash_engine;
62f58b1637b7c8d Neal Liu 2022-08-18  119  	crypto_engine = &hace_dev->crypto_engine;
108713a713c7e4b Neal Liu 2022-08-18  120  
108713a713c7e4b Neal Liu 2022-08-18  121  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
108713a713c7e4b Neal Liu 2022-08-18  122  
108713a713c7e4b Neal Liu 2022-08-18  123  	platform_set_drvdata(pdev, hace_dev);
108713a713c7e4b Neal Liu 2022-08-18  124  
108713a713c7e4b Neal Liu 2022-08-18  125  	hace_dev->regs = devm_ioremap_resource(&pdev->dev, res);
108713a713c7e4b Neal Liu 2022-08-18  126  	if (!hace_dev->regs) {
108713a713c7e4b Neal Liu 2022-08-18  127  		dev_err(&pdev->dev, "Failed to map resources\n");
108713a713c7e4b Neal Liu 2022-08-18  128  		return -ENOMEM;
108713a713c7e4b Neal Liu 2022-08-18  129  	}
108713a713c7e4b Neal Liu 2022-08-18  130  
108713a713c7e4b Neal Liu 2022-08-18  131  	/* Get irq number and register it */
108713a713c7e4b Neal Liu 2022-08-18  132  	hace_dev->irq = platform_get_irq(pdev, 0);
108713a713c7e4b Neal Liu 2022-08-18 @133  	if (!hace_dev->irq) {

This should be:

	if (hace_dev->irq < 0)
		return hace_dev->irq;

platform_get_irq() does not return zero, but if it did then treat it
as success.

108713a713c7e4b Neal Liu 2022-08-18  134  		dev_err(&pdev->dev, "Failed to get interrupt\n");
108713a713c7e4b Neal Liu 2022-08-18  135  		return -ENXIO;
108713a713c7e4b Neal Liu 2022-08-18  136  	}
108713a713c7e4b Neal Liu 2022-08-18  137  
108713a713c7e4b Neal Liu 2022-08-18  138  	rc = devm_request_irq(&pdev->dev, hace_dev->irq, aspeed_hace_irq, 0,
108713a713c7e4b Neal Liu 2022-08-18  139  			      dev_name(&pdev->dev), hace_dev);
108713a713c7e4b Neal Liu 2022-08-18  140  	if (rc) {
108713a713c7e4b Neal Liu 2022-08-18  141  		dev_err(&pdev->dev, "Failed to request interrupt\n");
108713a713c7e4b Neal Liu 2022-08-18  142  		return rc;
108713a713c7e4b Neal Liu 2022-08-18  143  	}
108713a713c7e4b Neal Liu 2022-08-18  144  
108713a713c7e4b Neal Liu 2022-08-18  145  	/* Get clk and enable it */





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux