[ofa-general] Re: [RFC PATCH 07/14] RFC IB/ipath: Fix sparse warning about pointer signedness
Arthur Jones
arthur.jones at qlogic.com
Mon Mar 3 08:05:32 PST 2008
hi roland, i fixed this one slightly differently,
and i prefer it to your fix. the patch is attached...
arthur
On Fri, Feb 29, 2008 at 08:26:03PM -0800, Roland Dreier wrote:
> ipath_count_units() wants its third parameter to be a u32 *, so change
> the declaration of maxofallports in find_best_unit() to be a u32 instead
> of a signed int. This fixes
>
> drivers/infiniband/hw/ipath/ipath_file_ops.c:1654:47: warning: incorrect type in argument 3 (different signedness)
> drivers/infiniband/hw/ipath/ipath_file_ops.c:1654:47: expected unsigned int [usertype] *maxportsp
> drivers/infiniband/hw/ipath/ipath_file_ops.c:1654:47: got int *<noident>
>
> Signed-off-by: Roland Dreier <rolandd at cisco.com>
> ---
> drivers/infiniband/hw/ipath/ipath_file_ops.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
> index 7e025c8..338733e 100644
> --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
> +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
> @@ -1648,7 +1648,8 @@ static int find_best_unit(struct file *fp,
> const struct ipath_user_info *uinfo)
> {
> int ret = 0, i, prefunit = -1, devmax;
> - int maxofallports, npresent, nup;
> + int npresent, nup;
> + u32 maxofallports;
> int ndev;
>
> devmax = ipath_count_units(&npresent, &nup, &maxofallports);
> --
> 1.5.4.2
>
-------------- next part --------------
IB/ipath - sparse cleanup, use int rather u32
u32 is not necessary here, use int instead,
this fixes sparse warning:
drivers/infiniband/hw/ipath/ipath_file_ops.c:1654:47: warning: incorrect type in argument 3 (different signedness)
drivers/infiniband/hw/ipath/ipath_file_ops.c:1654:47: expected unsigned int [usertype] *maxportsp
drivers/infiniband/hw/ipath/ipath_file_ops.c:1654:47: got int *<noident>
Signed-off-by: Arthur Jones <arthur.jones at qlogic.com>
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index db5f198..72fd16f 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -265,12 +265,12 @@ struct ipath_devdata *ipath_lookup(int unit)
return dd;
}
-int ipath_count_units(int *npresentp, int *nupp, u32 *maxportsp)
+int ipath_count_units(int *npresentp, int *nupp, int *maxportsp)
{
int nunits, npresent, nup;
struct ipath_devdata *dd;
unsigned long flags;
- u32 maxports;
+ int maxports;
nunits = npresent = nup = maxports = 0;
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 5d4ca80..17fc00c 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -834,7 +834,7 @@ extern struct ipath_devdata *ipath_lookup(int unit);
int ipath_init_chip(struct ipath_devdata *, int);
int ipath_enable_wc(struct ipath_devdata *dd);
void ipath_disable_wc(struct ipath_devdata *dd);
-int ipath_count_units(int *npresentp, int *nupp, u32 *maxportsp);
+int ipath_count_units(int *npresentp, int *nupp, int *maxportsp);
void ipath_shutdown_device(struct ipath_devdata *);
void ipath_clear_freeze(struct ipath_devdata *);
int ipath_signal_procs(struct ipath_devdata *, int);
More information about the general
mailing list