linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv7 0/5] Staging: most: several warnings fix reported by sparse
@ 2015-08-14 10:17 Adrian Remonda
  2015-08-14 10:18 ` [PATCHv7 1/5] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Adrian Remonda @ 2015-08-14 10:17 UTC (permalink / raw)
  Cc: adrianremonda, gregkh, christian.gromm, devel, linux-kernel

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
       v4: Fixed patch format as noted by Greg Kroah-Hartman
       v5: Because of using a non-updated tree previously two 
       patches did not apply
       v6: Clear warnings and styling issues
	   v7: Update patch format

Adrian Remonda (5):
  Staging: most: mostcore/core.c. Fix "missing static keyword" warnings
  Staging: most: mostcore/core.c. Fix "Using plain integer as NULL
    pointer" warnings
  Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword"
    warnings
  Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL
    pointer" warnings
  Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings

 drivers/staging/most/aim-cdev/cdev.c     | 18 +++++++++---------
 drivers/staging/most/hdm-dim2/dim2_hal.c |  2 +-
 drivers/staging/most/hdm-usb/hdm_usb.c   | 16 ++++++++--------
 drivers/staging/most/mostcore/core.c     | 17 +++++++++--------
 4 files changed, 27 insertions(+), 26 deletions(-)

-- 
2.1.4


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

* [PATCHv7 1/5] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings
  2015-08-14 10:17 [PATCHv7 0/5] Staging: most: several warnings fix reported by sparse Adrian Remonda
@ 2015-08-14 10:18 ` Adrian Remonda
  2015-08-19 14:30   ` Christian Gromm
  2015-08-14 10:18 ` [PATCHv7 2/5] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Adrian Remonda @ 2015-08-14 10:18 UTC (permalink / raw)
  Cc: adrianremonda, gregkh, christian.gromm, devel, linux-kernel

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 <adrianremonda@gmail.com>
---
 drivers/staging/most/mostcore/core.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index f4fea8cf5560..fa9c19b65a5c 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,8 @@ 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


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

* [PATCHv7 2/5] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings
  2015-08-14 10:17 [PATCHv7 0/5] Staging: most: several warnings fix reported by sparse Adrian Remonda
  2015-08-14 10:18 ` [PATCHv7 1/5] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
@ 2015-08-14 10:18 ` Adrian Remonda
  2015-08-19 14:30   ` Christian Gromm
  2015-08-14 10:18 ` [PATCHv7 3/5] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings Adrian Remonda
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Adrian Remonda @ 2015-08-14 10:18 UTC (permalink / raw)
  Cc: adrianremonda, gregkh, christian.gromm, devel, linux-kernel

This patch fixes the warning generated by sparse: "Using plain integer
as NULL pointer" by replacing the pointer test against 0 with a logical test.

Signed-off-by: Adrian Remonda <adrianremonda@gmail.com>
---
 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 fa9c19b65a5c..7bb16db42893 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 || *mdev_devnod == 0) {
 		snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, mdev_ch);
 		mdev_devnod = devnod_buf;
 	}
-- 
2.1.4


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

* [PATCHv7 3/5] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings
  2015-08-14 10:17 [PATCHv7 0/5] Staging: most: several warnings fix reported by sparse Adrian Remonda
  2015-08-14 10:18 ` [PATCHv7 1/5] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
  2015-08-14 10:18 ` [PATCHv7 2/5] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
@ 2015-08-14 10:18 ` Adrian Remonda
  2015-08-19 15:06   ` Christian Gromm
  2015-08-14 10:18 ` [PATCHv7 4/5] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
  2015-08-14 10:18 ` [PATCHv7 5/5] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings Adrian Remonda
  4 siblings, 1 reply; 11+ messages in thread
From: Adrian Remonda @ 2015-08-14 10:18 UTC (permalink / raw)
  Cc: adrianremonda, gregkh, christian.gromm, devel, linux-kernel

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 <adrianremonda@gmail.com>
---
 drivers/staging/most/hdm-usb/hdm_usb.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c
index 514ce3529b7a..305303f2f17c 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -290,7 +290,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;
 
@@ -328,7 +328,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;
@@ -365,7 +365,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];
@@ -644,7 +644,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;
@@ -743,8 +743,8 @@ _error:
  * @channel: channel ID
  * @conf: structure that holds the configuration information
  */
-int hdm_configure_channel(struct most_interface *iface, int channel,
-			  struct most_channel_config *conf)
+static int hdm_configure_channel(struct most_interface *iface, int channel,
+				 struct most_channel_config *conf)
 {
 	unsigned int num_frames;
 	unsigned int frame_size;
@@ -824,7 +824,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)
 {
 	struct device *dev = &mdev->usb_device->dev;
 	int i;
@@ -873,7 +873,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


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

* [PATCHv7 4/5] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings
  2015-08-14 10:17 [PATCHv7 0/5] Staging: most: several warnings fix reported by sparse Adrian Remonda
                   ` (2 preceding siblings ...)
  2015-08-14 10:18 ` [PATCHv7 3/5] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings Adrian Remonda
@ 2015-08-14 10:18 ` Adrian Remonda
  2015-08-19 15:12   ` Christian Gromm
  2015-08-14 10:18 ` [PATCHv7 5/5] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings Adrian Remonda
  4 siblings, 1 reply; 11+ messages in thread
From: Adrian Remonda @ 2015-08-14 10:18 UTC (permalink / raw)
  Cc: adrianremonda, gregkh, christian.gromm, devel, linux-kernel

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 <adrianremonda@gmail.com>
---
 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


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

* [PATCHv7 5/5] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings
  2015-08-14 10:17 [PATCHv7 0/5] Staging: most: several warnings fix reported by sparse Adrian Remonda
                   ` (3 preceding siblings ...)
  2015-08-14 10:18 ` [PATCHv7 4/5] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
@ 2015-08-14 10:18 ` Adrian Remonda
  2015-08-19 15:12   ` Christian Gromm
  4 siblings, 1 reply; 11+ messages in thread
From: Adrian Remonda @ 2015-08-14 10:18 UTC (permalink / raw)
  Cc: adrianremonda, gregkh, christian.gromm, devel, linux-kernel

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 <adrianremonda@gmail.com>
---
 drivers/staging/most/aim-cdev/cdev.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index 252a17cf153c..0a13d8d0fa39 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;
@@ -289,7 +289,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;
@@ -329,7 +329,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;
 
@@ -356,7 +356,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;
 
@@ -376,7 +376,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
@@ -390,9 +390,9 @@ struct most_aim cdev_aim;
  *
  * Returns 0 on success or error code otherwise.
  */
-int aim_probe(struct most_interface *iface, int channel_id,
-	      struct most_channel_config *cfg,
-	      struct kobject *parent, char *name)
+static int aim_probe(struct most_interface *iface, int channel_id,
+		     struct most_channel_config *cfg,
+		     struct kobject *parent, char *name)
 {
 	struct aim_channel *channel;
 	unsigned long cl_flags;
@@ -463,7 +463,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


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

* Re: [PATCHv7 1/5] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings
  2015-08-14 10:18 ` [PATCHv7 1/5] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
@ 2015-08-19 14:30   ` Christian Gromm
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Gromm @ 2015-08-19 14:30 UTC (permalink / raw)
  To: Adrian Remonda; +Cc: gregkh, devel, linux-kernel

On Fri, 14 Aug 2015 12:18:00 +0200
Adrian Remonda <adrianremonda@gmail.com> wrote:

> 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 <adrianremonda@gmail.com>
Acked-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  drivers/staging/most/mostcore/core.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
> index f4fea8cf5560..fa9c19b65a5c 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,8 @@ 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;


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

* Re: [PATCHv7 2/5] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings
  2015-08-14 10:18 ` [PATCHv7 2/5] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
@ 2015-08-19 14:30   ` Christian Gromm
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Gromm @ 2015-08-19 14:30 UTC (permalink / raw)
  To: Adrian Remonda; +Cc: gregkh, devel, linux-kernel

On Fri, 14 Aug 2015 12:18:01 +0200
Adrian Remonda <adrianremonda@gmail.com> wrote:

> This patch fixes the warning generated by sparse: "Using plain integer
> as NULL pointer" by replacing the pointer test against 0 with a logical test.
> 
> Signed-off-by: Adrian Remonda <adrianremonda@gmail.com>
Acked-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  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 fa9c19b65a5c..7bb16db42893 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 || *mdev_devnod == 0) {
>  		snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, mdev_ch);
>  		mdev_devnod = devnod_buf;
>  	}


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

* Re: [PATCHv7 3/5] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings
  2015-08-14 10:18 ` [PATCHv7 3/5] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings Adrian Remonda
@ 2015-08-19 15:06   ` Christian Gromm
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Gromm @ 2015-08-19 15:06 UTC (permalink / raw)
  To: Adrian Remonda; +Cc: gregkh, devel, linux-kernel

On Fri, 14 Aug 2015 12:18:02 +0200
Adrian Remonda <adrianremonda@gmail.com> 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 <adrianremonda@gmail.com>
Acked-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  drivers/staging/most/hdm-usb/hdm_usb.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c b/drivers/staging/most/hdm-usb/hdm_usb.c
> index 514ce3529b7a..305303f2f17c 100644
> --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> @@ -290,7 +290,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;
>  
> @@ -328,7 +328,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;
> @@ -365,7 +365,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];
> @@ -644,7 +644,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;
> @@ -743,8 +743,8 @@ _error:
>   * @channel: channel ID
>   * @conf: structure that holds the configuration information
>   */
> -int hdm_configure_channel(struct most_interface *iface, int channel,
> -			  struct most_channel_config *conf)
> +static int hdm_configure_channel(struct most_interface *iface, int channel,
> +				 struct most_channel_config *conf)
>  {
>  	unsigned int num_frames;
>  	unsigned int frame_size;
> @@ -824,7 +824,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)
>  {
>  	struct device *dev = &mdev->usb_device->dev;
>  	int i;
> @@ -873,7 +873,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;
>  


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

* Re: [PATCHv7 4/5] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings
  2015-08-14 10:18 ` [PATCHv7 4/5] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
@ 2015-08-19 15:12   ` Christian Gromm
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Gromm @ 2015-08-19 15:12 UTC (permalink / raw)
  To: Adrian Remonda; +Cc: gregkh, devel, linux-kernel

On Fri, 14 Aug 2015 12:18:03 +0200
Adrian Remonda <adrianremonda@gmail.com> wrote:

> 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 <adrianremonda@gmail.com>
> ---
>  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;

This has already been addressed.

Regards,
Chris


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

* Re: [PATCHv7 5/5] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings
  2015-08-14 10:18 ` [PATCHv7 5/5] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings Adrian Remonda
@ 2015-08-19 15:12   ` Christian Gromm
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Gromm @ 2015-08-19 15:12 UTC (permalink / raw)
  To: Adrian Remonda; +Cc: gregkh, devel, linux-kernel

On Fri, 14 Aug 2015 12:18:04 +0200
Adrian Remonda <adrianremonda@gmail.com> wrote:

> 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 <adrianremonda@gmail.com>
Acked-by: Christian Gromm <christian.gromm@microchip.com>
> ---
>  drivers/staging/most/aim-cdev/cdev.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
> index 252a17cf153c..0a13d8d0fa39 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;
> @@ -289,7 +289,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;
> @@ -329,7 +329,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;
>  
> @@ -356,7 +356,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;
>  
> @@ -376,7 +376,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
> @@ -390,9 +390,9 @@ struct most_aim cdev_aim;
>   *
>   * Returns 0 on success or error code otherwise.
>   */
> -int aim_probe(struct most_interface *iface, int channel_id,
> -	      struct most_channel_config *cfg,
> -	      struct kobject *parent, char *name)
> +static int aim_probe(struct most_interface *iface, int channel_id,
> +		     struct most_channel_config *cfg,
> +		     struct kobject *parent, char *name)
>  {
>  	struct aim_channel *channel;
>  	unsigned long cl_flags;
> @@ -463,7 +463,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,


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

end of thread, other threads:[~2015-08-19 15:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-14 10:17 [PATCHv7 0/5] Staging: most: several warnings fix reported by sparse Adrian Remonda
2015-08-14 10:18 ` [PATCHv7 1/5] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
2015-08-19 14:30   ` Christian Gromm
2015-08-14 10:18 ` [PATCHv7 2/5] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
2015-08-19 14:30   ` Christian Gromm
2015-08-14 10:18 ` [PATCHv7 3/5] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings Adrian Remonda
2015-08-19 15:06   ` Christian Gromm
2015-08-14 10:18 ` [PATCHv7 4/5] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
2015-08-19 15:12   ` Christian Gromm
2015-08-14 10:18 ` [PATCHv7 5/5] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings Adrian Remonda
2015-08-19 15:12   ` Christian Gromm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).