mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: "Petr Štetiar" <ynezz@true.cz>
Cc: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>,
	linux-kernel@vger.kernel.org, kbuild-all@01.org
Subject: drivers/of/of_net.c:64:2-8: ERROR: missing put_device; call of_find_device_by_node on line 57, but without a corresponding object release within this function. (fwd)
Date: Sun, 12 May 2019 08:51:59 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1905120850400.3167@hadrien> (raw)

[-- Attachment #1: Type: text/plain, Size: 4618 bytes --]

Hello,

You should drop the reference count on the value allocated with
of_find_device_by_node on line 57.

julia

---------- Forwarded message ----------
Date: Sun, 12 May 2019 10:20:42 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: drivers/of/of_net.c:64:2-8: ERROR: missing put_device; call
    of_find_device_by_node on line 57,
    but without a corresponding object release within this function.

CC: kbuild-all@01.org
CC: linux-kernel@vger.kernel.org
TO: "Petr Štetiar" <ynezz@true.cz>
CC: Felix Fietkau <nbd@nbd.name>
CC: John Crispin <john@phrozen.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8148c17b179d8acad190551fe0fb90d8f5193990
commit: d01f449c008a3f41fa44c603e28a7452ab8f8e68 of_net: add NVMEM support to of_get_mac_address
date:   6 days ago
:::::: branch date: 11 hours ago
:::::: commit date: 6 days ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>

>> drivers/of/of_net.c:64:2-8: ERROR: missing put_device; call of_find_device_by_node on line 57, but without a corresponding object release within this function.
   drivers/of/of_net.c:68:2-8: ERROR: missing put_device; call of_find_device_by_node on line 57, but without a corresponding object release within this function.
   drivers/of/of_net.c:82:1-7: ERROR: missing put_device; call of_find_device_by_node on line 57, but without a corresponding object release within this function.
   drivers/of/of_net.c:87:1-7: ERROR: missing put_device; call of_find_device_by_node on line 57, but without a corresponding object release within this function.

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d01f449c008a3f41fa44c603e28a7452ab8f8e68
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout d01f449c008a3f41fa44c603e28a7452ab8f8e68
vim +64 drivers/of/of_net.c

3eb46a1da Sergei Shtylyov 2015-03-18  51
d01f449c0 Petr Štetiar    2019-05-03  52  static const void *of_get_mac_addr_nvmem(struct device_node *np)
d01f449c0 Petr Štetiar    2019-05-03  53  {
d01f449c0 Petr Štetiar    2019-05-03  54  	int ret;
d01f449c0 Petr Štetiar    2019-05-03  55  	u8 mac[ETH_ALEN];
d01f449c0 Petr Štetiar    2019-05-03  56  	struct property *pp;
d01f449c0 Petr Štetiar    2019-05-03 @57  	struct platform_device *pdev = of_find_device_by_node(np);
d01f449c0 Petr Štetiar    2019-05-03  58
d01f449c0 Petr Štetiar    2019-05-03  59  	if (!pdev)
d01f449c0 Petr Štetiar    2019-05-03  60  		return ERR_PTR(-ENODEV);
d01f449c0 Petr Štetiar    2019-05-03  61
d01f449c0 Petr Štetiar    2019-05-03  62  	ret = nvmem_get_mac_address(&pdev->dev, &mac);
d01f449c0 Petr Štetiar    2019-05-03  63  	if (ret)
d01f449c0 Petr Štetiar    2019-05-03 @64  		return ERR_PTR(ret);
d01f449c0 Petr Štetiar    2019-05-03  65
d01f449c0 Petr Štetiar    2019-05-03  66  	pp = devm_kzalloc(&pdev->dev, sizeof(*pp), GFP_KERNEL);
d01f449c0 Petr Štetiar    2019-05-03  67  	if (!pp)
d01f449c0 Petr Štetiar    2019-05-03  68  		return ERR_PTR(-ENOMEM);
d01f449c0 Petr Štetiar    2019-05-03  69
d01f449c0 Petr Štetiar    2019-05-03  70  	pp->name = "nvmem-mac-address";
d01f449c0 Petr Štetiar    2019-05-03  71  	pp->length = ETH_ALEN;
d01f449c0 Petr Štetiar    2019-05-03  72  	pp->value = devm_kmemdup(&pdev->dev, mac, ETH_ALEN, GFP_KERNEL);
d01f449c0 Petr Štetiar    2019-05-03  73  	if (!pp->value) {
d01f449c0 Petr Štetiar    2019-05-03  74  		ret = -ENOMEM;
d01f449c0 Petr Štetiar    2019-05-03  75  		goto free;
d01f449c0 Petr Štetiar    2019-05-03  76  	}
d01f449c0 Petr Štetiar    2019-05-03  77
d01f449c0 Petr Štetiar    2019-05-03  78  	ret = of_add_property(np, pp);
d01f449c0 Petr Štetiar    2019-05-03  79  	if (ret)
d01f449c0 Petr Štetiar    2019-05-03  80  		goto free;
d01f449c0 Petr Štetiar    2019-05-03  81
d01f449c0 Petr Štetiar    2019-05-03  82  	return pp->value;
d01f449c0 Petr Štetiar    2019-05-03  83  free:
d01f449c0 Petr Štetiar    2019-05-03  84  	devm_kfree(&pdev->dev, pp->value);
d01f449c0 Petr Štetiar    2019-05-03  85  	devm_kfree(&pdev->dev, pp);
d01f449c0 Petr Štetiar    2019-05-03  86
d01f449c0 Petr Štetiar    2019-05-03  87  	return ERR_PTR(ret);
d01f449c0 Petr Štetiar    2019-05-03  88  }
d01f449c0 Petr Štetiar    2019-05-03  89

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

                 reply	other threads:[~2019-05-12  6:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.1905120850400.3167@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=john@phrozen.org \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=ynezz@true.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®