This patch series fix several warnings reported by the Sparse tool
v2: Fixed patch format and comments as noted by
Greg Kroah-Hartman and clear a few more warnings
v3: Fixed patch format as noted by Greg Kroah-Hartman
Adrian Remonda (6):
Staging: most: Fix "missing static keyword" warnings in the core.c file
Staging: most: Fix "Using plain integer as NULL pointer" warnings
in core.c file.
Staging: most: Fix "missing static keyword" warnings in the hdm_usb.c file
Staging: most: Fix "Using plain integer as NULL pointer" warnings
in dim2_hal.c file.
Staging: most: Fix "missing static keyword" warnings in the aim_cdev.c file
Staging: most: Fix "Using plain integer as NULL pointer" warnings
in networking.c file.
drivers/staging/most/aim-cdev/cdev.c | 14 +++++++-------
drivers/staging/most/aim-network/networking.c | 4 ++--
drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +-
drivers/staging/most/hdm-usb/hdm_usb.c | 14 +++++++-------
drivers/staging/most/mostcore/core.c | 16 ++++++++--------
5 files changed, 25 insertions(+), 25 deletions(-)
--
2.1.4
This is a patch to the mostcore/core.c file. It makes
several local functions and structures static to prevent global visibility.
Signed-off-by: Adrian Remonda <[email protected]>
---
drivers/staging/most/mostcore/core.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index f4f903404f1b..8d1b68dbeaf8 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -178,7 +178,7 @@ static void most_free_mbo_coherent(struct mbo *mbo)
* flush_channel_fifos - clear the channel fifos
* @c: pointer to channel object
*/
-void flush_channel_fifos(struct most_c_obj *c)
+static void flush_channel_fifos(struct most_c_obj *c)
{
unsigned long flags, hf_flags;
struct mbo *mbo, *tmp;
@@ -888,7 +888,7 @@ static ssize_t show_add_link(struct most_aim_obj *aim_obj,
* Input: "mdev0:ch0@ep_81"
* Output: *a -> "mdev0", *b -> "ch0@ep_81", *c == NULL
*/
-int split_string(char *buf, char **a, char **b, char **c)
+static int split_string(char *buf, char **a, char **b, char **c)
{
*a = strsep(&buf, ":");
if (!*a)
@@ -1006,7 +1006,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj,
return len;
}
-struct most_aim_attribute most_aim_attr_add_link =
+static struct most_aim_attribute most_aim_attr_add_link =
__ATTR(add_link, S_IRUGO | S_IWUSR, show_add_link, store_add_link);
static ssize_t show_remove_link(struct most_aim_obj *aim_obj,
@@ -1057,7 +1057,7 @@ static ssize_t store_remove_link(struct most_aim_obj *aim_obj,
return len;
}
-struct most_aim_attribute most_aim_attr_remove_link =
+static struct most_aim_attribute most_aim_attr_remove_link =
__ATTR(remove_link, S_IRUGO | S_IWUSR, show_remove_link, store_remove_link);
static struct attribute *most_aim_def_attrs[] = {
@@ -1121,14 +1121,14 @@ static void destroy_most_aim_obj(struct most_aim_obj *p)
/**
* Instantiation of the MOST bus
*/
-struct bus_type most_bus = {
+static struct bus_type most_bus = {
.name = "most",
};
/**
* Instantiation of the core driver
*/
-struct device_driver mostcore = {
+static struct device_driver mostcore = {
.name = "mostcore",
.bus = &most_bus,
};
@@ -1255,7 +1255,7 @@ static void arm_mbo(struct mbo *mbo)
*
* Returns the number of allocated and enqueued MBOs.
*/
-int arm_mbo_chain(struct most_c_obj *c, int dir, void (*compl)(struct mbo *))
+static int arm_mbo_chain(struct most_c_obj *c, int dir, void (*compl)(struct mbo *))
{
unsigned int i;
int retval;
--
2.1.4
This patch fixes the warning generated by sparse: "Using plain integer
as NULL pointer" by replacing the offending 0 with NULL.
Signed-off-by: Adrian Remonda <[email protected]>
---
drivers/staging/most/mostcore/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index 8d1b68dbeaf8..7e338217779c 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -982,7 +982,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj,
if (ret)
return ret;
- if (mdev_devnod == 0 || *mdev_devnod == 0) {
+ if (mdev_devnod == NULL || *mdev_devnod == 0) {
snprintf(devnod_buf, PAGE_SIZE, "%s-%s", mdev, mdev_ch);
mdev_devnod = devnod_buf;
}
--
2.1.4
This is a patch to the most/hdm-usb/hdm_usb.c file. It
makes several local functions and structures static to prevent global visibility.
Signed-off-by: Adrian Remonda <[email protected]>
---
drivers/staging/most/hdm-usb/hdm_usb.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c
index a4a3e266b3ef..f4de88403177 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -280,7 +280,7 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg)
*
* Returns 0 on success or error code otherwise.
*/
-int hdm_poison_channel(struct most_interface *iface, int channel)
+static int hdm_poison_channel(struct most_interface *iface, int channel)
{
struct most_dev *mdev;
@@ -318,7 +318,7 @@ int hdm_poison_channel(struct most_interface *iface, int channel)
* This inserts the INIC hardware specific padding bytes into a streaming
* channel's buffer
*/
-int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
+static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
{
struct most_channel_config *conf = &mdev->conf[channel];
unsigned int j, num_frames, frame_size;
@@ -354,7 +354,7 @@ int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
* This takes the INIC hardware specific padding bytes off a streaming
* channel's buffer.
*/
-int hdm_remove_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
+static int hdm_remove_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
{
unsigned int j, num_frames, frame_size;
struct most_channel_config *const conf = &mdev->conf[channel];
@@ -629,7 +629,7 @@ static void hdm_read_completion(struct urb *urb)
*
* Context: Could in _some_ cases be interrupt!
*/
-int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo)
+static int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo)
{
struct most_dev *mdev;
struct buf_anchor *anchor;
@@ -730,7 +730,7 @@ _error:
* @channel: channel ID
* @conf: structure that holds the configuration information
*/
-int hdm_configure_channel(struct most_interface *iface, int channel,
+static int hdm_configure_channel(struct most_interface *iface, int channel,
struct most_channel_config *conf)
{
unsigned int num_frames;
@@ -808,7 +808,7 @@ exit:
* This triggers the USB vendor requests to read the hardware address and
* the current link status of the attached device.
*/
-int hdm_update_netinfo(struct most_dev *mdev)
+static int hdm_update_netinfo(struct most_dev *mdev)
{
int i;
u16 link;
@@ -856,7 +856,7 @@ int hdm_update_netinfo(struct most_dev *mdev)
* polls for the NI state of the INIC every 2 seconds.
*
*/
-void hdm_request_netinfo(struct most_interface *iface, int channel)
+static void hdm_request_netinfo(struct most_interface *iface, int channel)
{
struct most_dev *mdev;
--
2.1.4
This patch fixes the warning generated by sparse: "Using plain integer
as NULL pointer" by replacing the offending 0 with NULL.
Signed-off-by: Adrian Remonda <[email protected]>
---
drivers/staging/most/hdm-dim2/dim2_hal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c b/drivers/staging/most/hdm-dim2/dim2_hal.c
index 01b748944ee4..a54cf2cedac3 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
@@ -889,7 +889,7 @@ struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch,
struct dim_ch_state_t *state_ptr)
{
if (!ch || !state_ptr)
- return 0;
+ return NULL;
state_ptr->ready = ch->state.level < 2;
state_ptr->done_buffers = ch->done_sw_buffers_number;
--
2.1.4
This is a patch to the most/aim_cdev.c file. It makes several
local functions and structures static to prevent global visibility.
Signed-off-by: Adrian Remonda <[email protected]>
---
drivers/staging/most/aim-cdev/cdev.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index d5fb4a0e0818..047acfbef793 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -49,7 +49,7 @@ static struct list_head channel_list;
static spinlock_t ch_list_lock;
-struct aim_channel *get_channel(struct most_interface *iface, int id)
+static struct aim_channel *get_channel(struct most_interface *iface, int id)
{
struct aim_channel *channel, *tmp;
unsigned long flags;
@@ -288,7 +288,7 @@ static const struct file_operations channel_fops = {
* This frees allocated memory and removes the cdev that represents this
* channel in user space.
*/
-int aim_disconnect_channel(struct most_interface *iface, int channel_id)
+static int aim_disconnect_channel(struct most_interface *iface, int channel_id)
{
struct aim_channel *channel;
unsigned long flags;
@@ -328,7 +328,7 @@ int aim_disconnect_channel(struct most_interface *iface, int channel_id)
* This searches for the channel linked to this MBO and stores it in the local
* fifo buffer.
*/
-int aim_rx_completion(struct mbo *mbo)
+static int aim_rx_completion(struct mbo *mbo)
{
struct aim_channel *channel;
@@ -355,7 +355,7 @@ int aim_rx_completion(struct mbo *mbo)
*
* This wakes sleeping processes in the wait-queue.
*/
-int aim_tx_completion(struct most_interface *iface, int channel_id)
+static int aim_tx_completion(struct most_interface *iface, int channel_id)
{
struct aim_channel *channel;
@@ -375,7 +375,7 @@ int aim_tx_completion(struct most_interface *iface, int channel_id)
return 0;
}
-struct most_aim cdev_aim;
+static struct most_aim cdev_aim;
/**
* aim_probe - probe function of the driver module
@@ -389,7 +389,7 @@ struct most_aim cdev_aim;
*
* Returns 0 on success or error code otherwise.
*/
-int aim_probe(struct most_interface *iface, int channel_id,
+static int aim_probe(struct most_interface *iface, int channel_id,
struct most_channel_config *cfg,
struct kobject *parent, char *name)
{
@@ -462,7 +462,7 @@ error_alloc_channel:
return retval;
}
-struct most_aim cdev_aim = {
+static struct most_aim cdev_aim = {
.name = "cdev",
.probe_channel = aim_probe,
.disconnect_channel = aim_disconnect_channel,
--
2.1.4
This patch fixes the warning generated by sparse: "Using plain integer
as NULL pointer" by replacing the offending 0 with NULL.
Signed-off-by: Adrian Remonda <[email protected]>
---
drivers/staging/most/aim-network/networking.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c
index 4639c49240f1..a1e1bce16296 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -295,7 +295,7 @@ static void most_net_rm_netdev_safe(struct net_dev_context *nd)
unregister_netdev(nd->dev);
free_netdev(nd->dev);
- nd->dev = 0;
+ nd->dev = NULL;
}
static struct net_dev_context *get_net_dev_context(
@@ -311,7 +311,7 @@ static struct net_dev_context *get_net_dev_context(
}
}
spin_unlock(&list_lock);
- return 0;
+ return NULL;
}
static int aim_probe_channel(struct most_interface *iface, int channel_idx,
--
2.1.4
The subjects still are not unique. Greg said this earlier.
If you want just do it in two patches.
[patch 1] add static
[patch 2] use NULL instead of zero
regards,
dan carpenter
On Mon, 3 Aug 2015 09:40:24 +0200
Adrian Remonda <[email protected]> wrote:
> This is a patch to the most/hdm-usb/hdm_usb.c file. It
> makes several local functions and structures static to prevent global visibility.
>
> Signed-off-by: Adrian Remonda <[email protected]>
> ---
> drivers/staging/most/hdm-usb/hdm_usb.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c
> index a4a3e266b3ef..f4de88403177 100644
> --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> @@ -280,7 +280,7 @@ static unsigned int get_stream_frame_size(struct most_channel_config *cfg)
> *
> * Returns 0 on success or error code otherwise.
> */
> -int hdm_poison_channel(struct most_interface *iface, int channel)
> +static int hdm_poison_channel(struct most_interface *iface, int channel)
> {
> struct most_dev *mdev;
>
> @@ -318,7 +318,7 @@ int hdm_poison_channel(struct most_interface *iface, int channel)
> * This inserts the INIC hardware specific padding bytes into a streaming
> * channel's buffer
> */
> -int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
> +static int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
> {
> struct most_channel_config *conf = &mdev->conf[channel];
> unsigned int j, num_frames, frame_size;
> @@ -354,7 +354,7 @@ int hdm_add_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
> * This takes the INIC hardware specific padding bytes off a streaming
> * channel's buffer.
> */
> -int hdm_remove_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
> +static int hdm_remove_padding(struct most_dev *mdev, int channel, struct mbo *mbo)
> {
> unsigned int j, num_frames, frame_size;
> struct most_channel_config *const conf = &mdev->conf[channel];
> @@ -629,7 +629,7 @@ static void hdm_read_completion(struct urb *urb)
> *
> * Context: Could in _some_ cases be interrupt!
> */
> -int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo)
> +static int hdm_enqueue(struct most_interface *iface, int channel, struct mbo *mbo)
> {
> struct most_dev *mdev;
> struct buf_anchor *anchor;
> @@ -730,7 +730,7 @@ _error:
> * @channel: channel ID
> * @conf: structure that holds the configuration information
> */
> -int hdm_configure_channel(struct most_interface *iface, int channel,
> +static int hdm_configure_channel(struct most_interface *iface, int channel,
> struct most_channel_config *conf)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please keep alignment with parameter list of this function.
Thanks,
Chris
> {
> unsigned int num_frames;
> @@ -808,7 +808,7 @@ exit:
> * This triggers the USB vendor requests to read the hardware address and
> * the current link status of the attached device.
> */
> -int hdm_update_netinfo(struct most_dev *mdev)
> +static int hdm_update_netinfo(struct most_dev *mdev)
> {
> int i;
> u16 link;
> @@ -856,7 +856,7 @@ int hdm_update_netinfo(struct most_dev *mdev)
> * polls for the NI state of the INIC every 2 seconds.
> *
> */
> -void hdm_request_netinfo(struct most_interface *iface, int channel)
> +static void hdm_request_netinfo(struct most_interface *iface, int channel)
> {
> struct most_dev *mdev;
>
On Mon, Aug 03, 2015 at 11:30:18AM +0300, Dan Carpenter wrote:
> The subjects still are not unique. Greg said this earlier.
>
> If you want just do it in two patches.
>
> [patch 1] add static
> [patch 2] use NULL instead of zero
>
> regards,
> dan carpenter
>
Yes, sorry. I totally messed it up. I thought Greg was referring just to
the cover letter.
Thanks for the hints
Regards,
Adrian