Miaoqian Lin and Greg Kroah-Hartman
4de009fc0a
most: core: Drop device reference after usage in get_channel()
...
commit b47b493d63 upstream.
In get_channel(), the reference obtained by bus_find_device_by_name()
was dropped via put_device() before accessing the device's driver data
Move put_device() after usage to avoid potential issues.
Fixes: 2485055394 ("staging: most: core: drop device reference")
Cc: stable <stable@kernel.org >
Signed-off-by: Miaoqian Lin <linmq006@gmail.com >
Link: https://lore.kernel.org/r/20250804082955.3621026-1-linmq006@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-08-28 16:28:45 +02:00
Rikard Falkeborn and Greg Kroah-Hartman
26c2e92261
most: core: Constify static attribute_group structs
...
The only usage of these is to put their addresses in arrays of pointers
to const attribute_groups. Make them const to allow the compiler to put
them in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com >
Link: https://lore.kernel.org/r/20210108221512.18811-1-rikard.falkeborn@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-01-26 19:24:51 +01:00
Colin Ian King and Greg Kroah-Hartman
e4463e49e2
staging: most: avoid null pointer dereference when iface is null
...
In the case where the pointer iface is null then the reporting of this
error will dereference iface when printing an error message causing which
is not ideal. Since the majority of callers to most_register_interface
report an error when -EINVAL is returned a simple fix is to just remove
the error message, I doubt it will be missed.
Addresses-Coverity: ("Dereference after null check")
Fixes: 57562a7241 ("Staging: most: add MOST driver's core module")
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Link: https://lore.kernel.org/r/20200624163957.11676-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-25 15:41:17 +02:00
Christian Gromm and Greg Kroah-Hartman
5e56bc06e1
most: core: use function subsys_initcall()
...
This patch replaces function module_init() with subsys_initcall().
It is needed to ensure that the core module of the driver is
initialized before a component tries to register with the core. This
leads to a NULL pointer dereference if the driver is configured as
in-tree.
Signed-off-by: Christian Gromm <christian.gromm@microchip.com >
Reported-by: kernel test robot <lkp@intel.com >
Link: https://lore.kernel.org/r/1587741394-22021-1-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-04-28 15:04:09 +02:00
Christian Gromm and Greg Kroah-Hartman
b276527539
staging: most: move core files out of the staging area
...
This patch moves the core module to the /drivers/most directory
and makes all necessary changes in order to not break the build.
Signed-off-by: Christian Gromm <christian.gromm@microchip.com >
Link: https://lore.kernel.org/r/1583845362-26707-2-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-24 13:42:44 +01:00