From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D2F3C4725D for ; Mon, 22 Jan 2024 13:38:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 080C46B007B; Mon, 22 Jan 2024 08:38:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 02DD86B00A0; Mon, 22 Jan 2024 08:38:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5ECC6B00A1; Mon, 22 Jan 2024 08:38:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D6A156B009F for ; Mon, 22 Jan 2024 08:38:54 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9637E12016C for ; Mon, 22 Jan 2024 13:38:54 +0000 (UTC) X-FDA: 81707052588.23.AEA98AC Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) by imf29.hostedemail.com (Postfix) with ESMTP id 9507D120003 for ; Mon, 22 Jan 2024 13:38:51 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Zn111FzX; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf29.hostedemail.com: domain of sui.jingfeng@linux.dev designates 95.215.58.171 as permitted sender) smtp.mailfrom=sui.jingfeng@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705930732; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JmnrHKbXAO3TGd6Zu20JTundsEm2C5LjZ6ICvCGjlKk=; b=3g6Lv5GHeU6t6JYrJ45/bOH4xKtTMaOuPgRtuATt4YZvHiJc6FqRLcr1bIPOva2qyyT8IL 5C63z8BPJ9ubU1AAKsdn2xeF58o+HeVbBdCVMkp/w4B6/kTZnjFoGL2wCU3CXlOd5S0oYq PbgPJlBtgRsax4z/yjoDh06HOluJs/U= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Zn111FzX; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf29.hostedemail.com: domain of sui.jingfeng@linux.dev designates 95.215.58.171 as permitted sender) smtp.mailfrom=sui.jingfeng@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705930732; a=rsa-sha256; cv=none; b=qirTrQr9vAvD5xVirNXeK278gdFYnzcUinjzFL30TGEek+9sqlL1rNR/hVkDntkLftbslt n2pGlMnswe0gfsiO8LRjn4OFACV8bC2QnMD22cNAOUAb+/3fC3IZ4LOOzOzF6P6ExbvrK4 I2zfpKdsaCYd7xMh3e421mu2ajR68TI= Message-ID: <6d51b75b-dfb6-4eda-9f48-ee83d4969b23@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1705930729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JmnrHKbXAO3TGd6Zu20JTundsEm2C5LjZ6ICvCGjlKk=; b=Zn111FzXgVRxxERGxjEQ2yi7Kvq6L9uBqjXiJxfgBeF9DrIs8V4bknYIa3Tr+pd69D5wCz YJV097d/tsfHV3Io7/QNG3Obzie+mZwQBQxFbCkpYh+vxOo4KJ89a4SJ7vehgcSlrS0OGI ugprWV8IANaMI/SQHUAbFYHu5s7pN8M= Date: Mon, 22 Jan 2024 21:38:38 +0800 MIME-Version: 1.0 Subject: Re: [linux-next:master 139/1036] drivers/gpu/drm/etnaviv/etnaviv_drv.c:614:3-14: ERROR: probable double put. (fwd) To: Julia Lawall , Lucas Stach Cc: Linux Memory Management List , oe-kbuild-all@lists.linux.dev References: <94afe420-f3b-5620-2380-82c9c62838f0@inria.fr> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui JIngfeng In-Reply-To: <94afe420-f3b-5620-2380-82c9c62838f0@inria.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 9507D120003 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: hq8bapidqpaodya31b6buw6a4ce5af8a X-HE-Tag: 1705930731-77925 X-HE-Meta: U2FsdGVkX1/47dVIBgFXRVrkK28GTGsiIWOy9GBbZPjC52hc5Sj1e0VYsB/RcNllGPYrKQnBNxuTqgrtncfo+pZXPgmfvWukis2EFOKW2bow3qdEtmXGK5ZFjrtN2c61AbCbN7cRCg79zkKIZmhhseOuEE0WczFuGJKqxsQ+Qv0TX+rR60i+hwChXOcFkLUkD4hnceos+BjOicYacL39AwNJdKUZ12+IeALL3dXHcDPz7gAIoT/WMOEv43PP5XxZACN+OvZTkeyeGbhfngwMPFkoAVBYgEZJWvBnKBPpiPHzipHioYbOaFUm+DuoYsJBO2DQ4ugB+zrdpyFWZ+KNFr7V/2kzeAJj5ygsYjHKsD0oDQH6Tq01QuOeOmKwfwqdGJUa6BpDv6gmBHwlzKH6Gvg0rPrJX0dtDk0F3MDuidE4viqFipYW1T/I/UZEyA1W7e6JUqaLWSLoZty0NDK9iFLAxFW4+BVmq+PIX892GtX7H9FfUGCuGbAETTkR555lJrOsN0Ex31bfQ8yASLeozMvGIZe1T3JQBJ+cp+aCso9qyd+X61lxY+g37pnjpmXh0//LFwiPCtbKRjECNkmJIhGYNdEeHSWP7eb0sZ9ap1YYE2+bOnPpuHWRxMTEyOhWkomkAnf4G/rAIuPg0osxCWryoM6X7us3XoYwd6p/uOi76mdzzECjC3eZLbxxMD3XcamcRzG12KyHku2gOwWYTuW9YtZgPXf50TSIbtIrVdZZqeF4VQ2eIqqc3YK6QYLq2BvepQ0RMEy3tZKBBV8yfBERYieI+dBgQX2HXn4XYx1kO1+rejnLba/tG4u+bUbgWwEGDG4l1ST+ON+8Il1xJnlDc06G3hz4JDrW/VSIdV/DRWLuxPZUuNleKtGjSTTDUyQ1/oX7JtDwnImdZbDgVSOepjerIEHuatpIn7U8OLANfpUzOifFnlIKGbH5+t2A7TdfHIK6oPJrA6txpXS 3u13jX/c drirek4BlGFU7N+97eu6MBJJlvBdAw7hCN6mzNMw4wkCmHh1s9wBFiChYRaYCrB0RcA67w7YFKwoeHx1/Xymow69BgU6k8UD+AjjpXYlyYVxd5J8faxmPpEBrd8EFh4C40pHIZY+vHim37NbkBD8RWJpYsaMLHftyu/OvZ/S6rWgtYJ4JrdUKOL/u7hnnA3KR7eNu9fkR+MayenW3Dp4KYgfqOD8/O32ZswM786Z5CW6LBdk4fkoX9+uGuEDSI2xs2GLuqxKrxc2PugTBeHCxYYIGKRHkbreKhOizJCGzi5pfhWk/nWlbAM5UhG+bno+0iRKeXIBxj7+OvKdrApP7cQHuBpBFAd5J7mpHO+LzYs3hoRQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi, On 2024/1/22 20:33, Julia Lawall wrote: > The of_node_put on line 614 does not look useful. Yes, you are right. It seems that I introduce a problem. Sorry Lucas. 😭 The following code snippet probably will helps to fix this warning: ``` if(!dev->platform_data){ structdevice_node*core_node = NULL; for_each_compatible_node(core_node, NULL, "vivante,gc"){ if(!of_device_is_available(core_node)) continue; drm_of_component_match_add(&pdev->dev, &match, component_compare_of, core_node); } if (core_node) of_node_put(core_node); } ``` I think I should post a patch to fix this? > julia > > ---------- Forwarded message ---------- > Date: Mon, 22 Jan 2024 19:18:22 +0800 > From: kernel test robot > To: oe-kbuild@lists.linux.dev > Cc: lkp@intel.com, Julia Lawall > Subject: [linux-next:master 139/1036] > drivers/gpu/drm/etnaviv/etnaviv_drv.c:614:3-14: ERROR: probable double put. > > BCC: lkp@intel.com > CC: oe-kbuild-all@lists.linux.dev > CC: Linux Memory Management List > TO: Sui Jingfeng > CC: Lucas Stach > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 319fbd8fc6d339e0a1c7b067eed870c518a13a02 > commit: 56df40c804fa40712239478355abe265aeda2197 [139/1036] drm/etnaviv: Add a helper to get the first available GPU device node > :::::: branch date: 10 hours ago > :::::: commit date: 3 months ago > config: x86_64-randconfig-102-20240122 (https://download.01.org/0day-ci/archive/20240122/202401221903.GjEKVu8R-lkp@intel.com/config) > compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) > > 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 > | Reported-by: Julia Lawall > | Closes: https://lore.kernel.org/r/202401221903.GjEKVu8R-lkp@intel.com/ > > cocci warnings: (new ones prefixed by >>) >>> drivers/gpu/drm/etnaviv/etnaviv_drv.c:614:3-14: ERROR: probable double put. > vim +614 drivers/gpu/drm/etnaviv/etnaviv_drv.c > > a8c21a5451d831 The etnaviv authors 2015-12-03 597 > a8c21a5451d831 The etnaviv authors 2015-12-03 598 static int etnaviv_pdev_probe(struct platform_device *pdev) > a8c21a5451d831 The etnaviv authors 2015-12-03 599 { > a8c21a5451d831 The etnaviv authors 2015-12-03 600 struct device *dev = &pdev->dev; > 0ea057a9cb2be4 Michael Walle 2021-09-07 601 struct device_node *first_node = NULL; > a8c21a5451d831 The etnaviv authors 2015-12-03 602 struct component_match *match = NULL; > a8c21a5451d831 The etnaviv authors 2015-12-03 603 > 246774d17fc05a Lucas Stach 2018-01-24 604 if (!dev->platform_data) { > a8c21a5451d831 The etnaviv authors 2015-12-03 605 struct device_node *core_node; > a8c21a5451d831 The etnaviv authors 2015-12-03 606 > 246774d17fc05a Lucas Stach 2018-01-24 607 for_each_compatible_node(core_node, NULL, "vivante,gc") { > 246774d17fc05a Lucas Stach 2018-01-24 608 if (!of_device_is_available(core_node)) > 246774d17fc05a Lucas Stach 2018-01-24 609 continue; > a8c21a5451d831 The etnaviv authors 2015-12-03 610 > 97ac0e47aed5f6 Russell King 2016-10-19 611 drm_of_component_match_add(&pdev->dev, &match, > 0a522394202f1f Yong Wu 2022-02-14 612 component_compare_of, core_node); > 56df40c804fa40 Sui Jingfeng 2023-10-02 613 > 56df40c804fa40 Sui Jingfeng 2023-10-02 @614 of_node_put(core_node); > a8c21a5451d831 The etnaviv authors 2015-12-03 615 } > 246774d17fc05a Lucas Stach 2018-01-24 616 } else { > a8c21a5451d831 The etnaviv authors 2015-12-03 617 char **names = dev->platform_data; > a8c21a5451d831 The etnaviv authors 2015-12-03 618 unsigned i; > a8c21a5451d831 The etnaviv authors 2015-12-03 619 > a8c21a5451d831 The etnaviv authors 2015-12-03 620 for (i = 0; names[i]; i++) > 0a522394202f1f Yong Wu 2022-02-14 621 component_match_add(dev, &match, component_compare_dev_name, names[i]); > a8c21a5451d831 The etnaviv authors 2015-12-03 622 } > a8c21a5451d831 The etnaviv authors 2015-12-03 623 > f5be833dc86f49 Michael Walle 2021-09-07 624 /* > f5be833dc86f49 Michael Walle 2021-09-07 625 * PTA and MTLB can have 40 bit base addresses, but > f5be833dc86f49 Michael Walle 2021-09-07 626 * unfortunately, an entry in the MTLB can only point to a > f5be833dc86f49 Michael Walle 2021-09-07 627 * 32 bit base address of a STLB. Moreover, to initialize the > f5be833dc86f49 Michael Walle 2021-09-07 628 * MMU we need a command buffer with a 32 bit address because > f5be833dc86f49 Michael Walle 2021-09-07 629 * without an MMU there is only an indentity mapping between > f5be833dc86f49 Michael Walle 2021-09-07 630 * the internal 32 bit addresses and the bus addresses. > f5be833dc86f49 Michael Walle 2021-09-07 631 * > f5be833dc86f49 Michael Walle 2021-09-07 632 * To make things easy, we set the dma_coherent_mask to 32 > f5be833dc86f49 Michael Walle 2021-09-07 633 * bit to make sure we are allocating the command buffers and > f5be833dc86f49 Michael Walle 2021-09-07 634 * TLBs in the lower 4 GiB address space. > f5be833dc86f49 Michael Walle 2021-09-07 635 */ > f5be833dc86f49 Michael Walle 2021-09-07 636 if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(40)) || > f5be833dc86f49 Michael Walle 2021-09-07 637 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) { > f5be833dc86f49 Michael Walle 2021-09-07 638 dev_dbg(&pdev->dev, "No suitable DMA available\n"); > f5be833dc86f49 Michael Walle 2021-09-07 639 return -ENODEV; > f5be833dc86f49 Michael Walle 2021-09-07 640 } > f5be833dc86f49 Michael Walle 2021-09-07 641 > 0ea057a9cb2be4 Michael Walle 2021-09-07 642 /* > 0ea057a9cb2be4 Michael Walle 2021-09-07 643 * Apply the same DMA configuration to the virtual etnaviv > 0ea057a9cb2be4 Michael Walle 2021-09-07 644 * device as the GPU we found. This assumes that all Vivante > 0ea057a9cb2be4 Michael Walle 2021-09-07 645 * GPUs in the system share the same DMA constraints. > 0ea057a9cb2be4 Michael Walle 2021-09-07 646 */ > 56df40c804fa40 Sui Jingfeng 2023-10-02 647 first_node = etnaviv_of_first_available_node(); > 56df40c804fa40 Sui Jingfeng 2023-10-02 648 if (first_node) { > 0ea057a9cb2be4 Michael Walle 2021-09-07 649 of_dma_configure(&pdev->dev, first_node, true); > 56df40c804fa40 Sui Jingfeng 2023-10-02 650 of_node_put(first_node); > 56df40c804fa40 Sui Jingfeng 2023-10-02 651 } > 0ea057a9cb2be4 Michael Walle 2021-09-07 652 > a8c21a5451d831 The etnaviv authors 2015-12-03 653 return component_master_add_with_match(dev, &etnaviv_master_ops, match); > a8c21a5451d831 The etnaviv authors 2015-12-03 654 } > a8c21a5451d831 The etnaviv authors 2015-12-03 655 >