All of lore.kernel.org
 help / color / mirror / Atom feed
* [jpirko-mlxsw:linecards 44/102] net/core/devlink.c:9601 devlink_linecard_create() warn: inconsistent returns '&devlink->lock'.
@ 2021-06-24  9:40 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-06-24  5:37 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
TO: Jiri Pirko <jiri@nvidia.com>

tree:   https://github.com/jpirko/linux_mlxsw linecards
head:   420093481d1127af592411fb8b759713182acc9c
commit: fad324f26145b7917eaee575b01cd9121353cc39 [44/102] devlink: add support to create line card and expose to user
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago
config: x86_64-randconfig-m001-20210622 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/core/devlink.c:9601 devlink_linecard_create() warn: inconsistent returns '&devlink->lock'.

Old smatch warnings:
net/core/devlink.c:6634 devlink_fmsg_prepare_skb() error: uninitialized symbol 'err'.

vim +9601 net/core/devlink.c

af3836df9a59e7 Jiri Pirko 2019-03-28  9570  
fad324f26145b7 Jiri Pirko 2020-12-28  9571  /**
fad324f26145b7 Jiri Pirko 2020-12-28  9572   *	devlink_linecard_create - Create devlink linecard
fad324f26145b7 Jiri Pirko 2020-12-28  9573   *
fad324f26145b7 Jiri Pirko 2020-12-28  9574   *	@devlink: devlink
fad324f26145b7 Jiri Pirko 2020-12-28  9575   *	@devlink_linecard: devlink linecard
fad324f26145b7 Jiri Pirko 2020-12-28  9576   *	@linecard_index: driver-specific numerical identifier of the linecard
fad324f26145b7 Jiri Pirko 2020-12-28  9577   *
fad324f26145b7 Jiri Pirko 2020-12-28  9578   *	Create devlink linecard instance with provided linecard index.
fad324f26145b7 Jiri Pirko 2020-12-28  9579   *	Caller can use any indexing, even hw-related one.
fad324f26145b7 Jiri Pirko 2020-12-28  9580   */
fad324f26145b7 Jiri Pirko 2020-12-28  9581  struct devlink_linecard *devlink_linecard_create(struct devlink *devlink,
fad324f26145b7 Jiri Pirko 2020-12-28  9582  						 unsigned int linecard_index)
fad324f26145b7 Jiri Pirko 2020-12-28  9583  {
fad324f26145b7 Jiri Pirko 2020-12-28  9584  	struct devlink_linecard *linecard;
fad324f26145b7 Jiri Pirko 2020-12-28  9585  
fad324f26145b7 Jiri Pirko 2020-12-28  9586  	mutex_lock(&devlink->lock);
fad324f26145b7 Jiri Pirko 2020-12-28  9587  	if (devlink_linecard_index_exists(devlink, linecard_index)) {
fad324f26145b7 Jiri Pirko 2020-12-28  9588  		mutex_unlock(&devlink->lock);
fad324f26145b7 Jiri Pirko 2020-12-28  9589  		return ERR_PTR(-EEXIST);
fad324f26145b7 Jiri Pirko 2020-12-28  9590  	}
fad324f26145b7 Jiri Pirko 2020-12-28  9591  
fad324f26145b7 Jiri Pirko 2020-12-28  9592  	linecard = kzalloc(sizeof(*linecard), GFP_KERNEL);
fad324f26145b7 Jiri Pirko 2020-12-28  9593  	if (!linecard)
fad324f26145b7 Jiri Pirko 2020-12-28  9594  		return ERR_PTR(-ENOMEM);
fad324f26145b7 Jiri Pirko 2020-12-28  9595  
fad324f26145b7 Jiri Pirko 2020-12-28  9596  	linecard->devlink = devlink;
fad324f26145b7 Jiri Pirko 2020-12-28  9597  	linecard->index = linecard_index;
fad324f26145b7 Jiri Pirko 2020-12-28  9598  	list_add_tail(&linecard->list, &devlink->linecard_list);
fad324f26145b7 Jiri Pirko 2020-12-28  9599  	devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_NEW);
fad324f26145b7 Jiri Pirko 2020-12-28  9600  	mutex_unlock(&devlink->lock);
fad324f26145b7 Jiri Pirko 2020-12-28 @9601  	return linecard;
fad324f26145b7 Jiri Pirko 2020-12-28  9602  }
fad324f26145b7 Jiri Pirko 2020-12-28  9603  EXPORT_SYMBOL_GPL(devlink_linecard_create);
fad324f26145b7 Jiri Pirko 2020-12-28  9604  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 50307 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [jpirko-mlxsw:linecards 44/102] net/core/devlink.c:9601 devlink_linecard_create() warn: inconsistent returns '&devlink->lock'.
@ 2021-06-24  9:40 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2021-06-24  9:40 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://github.com/jpirko/linux_mlxsw linecards
head:   420093481d1127af592411fb8b759713182acc9c
commit: fad324f26145b7917eaee575b01cd9121353cc39 [44/102] devlink: add support to create line card and expose to user
config: x86_64-randconfig-m001-20210622 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/core/devlink.c:9601 devlink_linecard_create() warn: inconsistent returns '&devlink->lock'.

Old smatch warnings:
net/core/devlink.c:6634 devlink_fmsg_prepare_skb() error: uninitialized symbol 'err'.

vim +9601 net/core/devlink.c

fad324f26145b7 Jiri Pirko 2020-12-28  9581  struct devlink_linecard *devlink_linecard_create(struct devlink *devlink,
fad324f26145b7 Jiri Pirko 2020-12-28  9582  						 unsigned int linecard_index)
fad324f26145b7 Jiri Pirko 2020-12-28  9583  {
fad324f26145b7 Jiri Pirko 2020-12-28  9584  	struct devlink_linecard *linecard;
fad324f26145b7 Jiri Pirko 2020-12-28  9585  
fad324f26145b7 Jiri Pirko 2020-12-28  9586  	mutex_lock(&devlink->lock);
fad324f26145b7 Jiri Pirko 2020-12-28  9587  	if (devlink_linecard_index_exists(devlink, linecard_index)) {
fad324f26145b7 Jiri Pirko 2020-12-28  9588  		mutex_unlock(&devlink->lock);
fad324f26145b7 Jiri Pirko 2020-12-28  9589  		return ERR_PTR(-EEXIST);
fad324f26145b7 Jiri Pirko 2020-12-28  9590  	}
fad324f26145b7 Jiri Pirko 2020-12-28  9591  
fad324f26145b7 Jiri Pirko 2020-12-28  9592  	linecard = kzalloc(sizeof(*linecard), GFP_KERNEL);
fad324f26145b7 Jiri Pirko 2020-12-28  9593  	if (!linecard)
fad324f26145b7 Jiri Pirko 2020-12-28  9594  		return ERR_PTR(-ENOMEM);

mutex_unlock(&devlink->lock); before returning

fad324f26145b7 Jiri Pirko 2020-12-28  9595  
fad324f26145b7 Jiri Pirko 2020-12-28  9596  	linecard->devlink = devlink;
fad324f26145b7 Jiri Pirko 2020-12-28  9597  	linecard->index = linecard_index;
fad324f26145b7 Jiri Pirko 2020-12-28  9598  	list_add_tail(&linecard->list, &devlink->linecard_list);
fad324f26145b7 Jiri Pirko 2020-12-28  9599  	devlink_linecard_notify(linecard, DEVLINK_CMD_LINECARD_NEW);
fad324f26145b7 Jiri Pirko 2020-12-28  9600  	mutex_unlock(&devlink->lock);
fad324f26145b7 Jiri Pirko 2020-12-28 @9601  	return linecard;
fad324f26145b7 Jiri Pirko 2020-12-28  9602  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-24  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  5:37 [jpirko-mlxsw:linecards 44/102] net/core/devlink.c:9601 devlink_linecard_create() warn: inconsistent returns '&devlink->lock' kernel test robot
2021-06-24  9:40 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.