2015-08-02 17:57:49

by Adrian Remonda

[permalink] [raw]
Subject: [PATCH 0/4] Staging: most: several warnings fix reported by sparse

This patch series fix several warnings reported by the Sparse tool

Adrian Remonda (4):
This is a patch to the mostcore/core.c file. It makes several local
functions static to prevent global visibility.
This patch fix the using plain integer as NULL pointer
This is a patch to the most/hdm-usb/hdm_usb.c file. It makes several
local functions static to prevent global visibility.
This patch fix the using plain integer as NULL pointer

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 ++++++++--------
3 files changed, 16 insertions(+), 16 deletions(-)

--
2.1.4


2015-08-02 17:57:56

by Adrian Remonda

[permalink] [raw]
Subject: [PATCH 1/4] Staging: most: static keyword missing

This is a patch to the mostcore/core.c file. It makes
several local functions 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

2015-08-02 17:57:54

by Adrian Remonda

[permalink] [raw]
Subject: [PATCH 2/4] Plain integer instead of NULL pointer fix

This patch fix the using plain integer as NULL pointer

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

2015-08-02 17:58:45

by Adrian Remonda

[permalink] [raw]
Subject: [PATCH 3/4] Staging: most: static keyword missing

This is a patch to the most/hdm-usb/hdm_usb.c file. It
makes several local functions 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

2015-08-02 17:58:20

by Adrian Remonda

[permalink] [raw]
Subject: [PATCH 4/4] Plain integer instead of NULL pointer fix

This patch fix the using plain integer as NULL pointer

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

2015-08-02 19:22:39

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/4] Plain integer instead of NULL pointer fix

On Sun, Aug 02, 2015 at 07:57:20PM +0200, Adrian Remonda wrote:
> This patch fix the using plain integer as NULL pointer

That sentance doesn't make much sense, why are you changing this?

>
> Signed-off-by: Adrian Remonda <[email protected]>
> ---
> drivers/staging/most/mostcore/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

this patch, and patch 4/4 were the exact same subject, and you don't
have the "staging: most" prefix on them, so I can't take them.

Please fix up and resend.

thanks,

greg k-h

2015-08-02 19:24:35

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/4] Staging: most: static keyword missing

On Sun, Aug 02, 2015 at 07:57:19PM +0200, Adrian Remonda wrote:
> This is a patch to the mostcore/core.c file. It makes
> several local functions static to prevent global visibility.

You also change structure's visibility, please mention that when you
resend this patch.

thanks,

greg k-h