All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv4 0/6] Staging: most: several warnings fix reported by sparse
@ 2015-08-03 21:22 Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 1/6] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Adrian Remonda @ 2015-08-03 21:22 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  

Adrian Remonda (6):
  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
  Staging: most: aim-network/networking.c. Fix "Using plain integer as
    NULL pointer" warnings

 drivers/staging/most/aim-cdev/cdev.c          | 18 +++++++++---------
 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        | 16 ++++++++--------
 drivers/staging/most/mostcore/core.c          | 16 ++++++++--------
 5 files changed, 28 insertions(+), 28 deletions(-)

-- 
2.1.4


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

* [PATCHv4 1/6] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings
  2015-08-03 21:22 [PATCHv4 0/6] Staging: most: several warnings fix reported by sparse Adrian Remonda
@ 2015-08-03 21:22 ` Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 2/6] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Adrian Remonda @ 2015-08-03 21:22 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 | 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


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

* [PATCHv4 2/6] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings
  2015-08-03 21:22 [PATCHv4 0/6] Staging: most: several warnings fix reported by sparse Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 1/6] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
@ 2015-08-03 21:22 ` Adrian Remonda
  2015-08-04  6:51   ` Sudip Mukherjee
  2015-08-03 21:22 ` [PATCHv4 3/6] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings Adrian Remonda
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Adrian Remonda @ 2015-08-03 21:22 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/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


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

* [PATCHv4 3/6] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings
  2015-08-03 21:22 [PATCHv4 0/6] Staging: most: several warnings fix reported by sparse Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 1/6] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 2/6] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
@ 2015-08-03 21:22 ` Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 4/6] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Adrian Remonda @ 2015-08-03 21:22 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 a4a3e266b3ef..09a92566ed7d 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,8 +730,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;
@@ -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


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

* [PATCHv4 4/6] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings
  2015-08-03 21:22 [PATCHv4 0/6] Staging: most: several warnings fix reported by sparse Adrian Remonda
                   ` (2 preceding siblings ...)
  2015-08-03 21:22 ` [PATCHv4 3/6] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings Adrian Remonda
@ 2015-08-03 21:22 ` Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 5/6] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 6/6] Staging: most: aim-network/networking.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
  5 siblings, 0 replies; 8+ messages in thread
From: Adrian Remonda @ 2015-08-03 21:22 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] 8+ messages in thread

* [PATCHv4 5/6] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings
  2015-08-03 21:22 [PATCHv4 0/6] Staging: most: several warnings fix reported by sparse Adrian Remonda
                   ` (3 preceding siblings ...)
  2015-08-03 21:22 ` [PATCHv4 4/6] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
@ 2015-08-03 21:22 ` Adrian Remonda
  2015-08-03 21:22 ` [PATCHv4 6/6] Staging: most: aim-network/networking.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
  5 siblings, 0 replies; 8+ messages in thread
From: Adrian Remonda @ 2015-08-03 21:22 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 d5fb4a0e0818..f38b4e2b2269 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,9 +389,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;
@@ -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


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

* [PATCHv4 6/6] Staging: most: aim-network/networking.c. Fix "Using plain integer as NULL pointer" warnings
  2015-08-03 21:22 [PATCHv4 0/6] Staging: most: several warnings fix reported by sparse Adrian Remonda
                   ` (4 preceding siblings ...)
  2015-08-03 21:22 ` [PATCHv4 5/6] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings Adrian Remonda
@ 2015-08-03 21:22 ` Adrian Remonda
  5 siblings, 0 replies; 8+ messages in thread
From: Adrian Remonda @ 2015-08-03 21:22 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/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


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

* Re: [PATCHv4 2/6] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings
  2015-08-03 21:22 ` [PATCHv4 2/6] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
@ 2015-08-04  6:51   ` Sudip Mukherjee
  0 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2015-08-04  6:51 UTC (permalink / raw)
  To: Adrian Remonda; +Cc: devel, christian.gromm, linux-kernel, gregkh

On Mon, Aug 03, 2015 at 11:22:35PM +0200, Adrian Remonda 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>
> ---
This patch will not apply because of 7ac5c9f0a022 ("Staging: most: fix
snprintf() is printing too much").

You need to update your tree.

regards
sudip

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

end of thread, other threads:[~2015-08-04  6:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-03 21:22 [PATCHv4 0/6] Staging: most: several warnings fix reported by sparse Adrian Remonda
2015-08-03 21:22 ` [PATCHv4 1/6] Staging: most: mostcore/core.c. Fix "missing static keyword" warnings Adrian Remonda
2015-08-03 21:22 ` [PATCHv4 2/6] Staging: most: mostcore/core.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
2015-08-04  6:51   ` Sudip Mukherjee
2015-08-03 21:22 ` [PATCHv4 3/6] Staging: most: hdm-usb/hdm_usb.c. Fix "missing static keyword" warnings Adrian Remonda
2015-08-03 21:22 ` [PATCHv4 4/6] Staging: most: hdm-dim2/dim2_hal.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda
2015-08-03 21:22 ` [PATCHv4 5/6] Staging: most: aim-cdev/cdev.c. Fix "missing static keyword" warnings Adrian Remonda
2015-08-03 21:22 ` [PATCHv4 6/6] Staging: most: aim-network/networking.c. Fix "Using plain integer as NULL pointer" warnings Adrian Remonda

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.