lkml.org 
[lkml]   [2014]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 7/7] staging: cxt1e1: remove unneeded a value
On 2014-03-05 at 02:24:22 +0100, Daeseok Youn <daeseok.youn@gmail.com> wrote:
>
> It doesn't need to assign name array address to np pointer.
>
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---
> drivers/staging/cxt1e1/linux.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c
> index 5bb42ae..cae8c66 100644
> --- a/drivers/staging/cxt1e1/linux.c
> +++ b/drivers/staging/cxt1e1/linux.c
> @@ -205,15 +205,14 @@ status_t
> c4_wq_port_init(mpi_t *pi)
> {
>
> - char name[16], *np; /* NOTE: name of the queue limited by system
> + char name[16]; /* NOTE: name of the queue limited by system
> * to 10 characters */
>
> if (pi->wq_port)
> return 0; /* already initialized */
>
> - np = name;
> memset(name, 0, 16);

This isn't necessary since s{,n}printf() adds a terminating '\0'.

> - sprintf(np, "%s%d", pi->up->devname, pi->portnum); /* IE pmcc4-01) */
> + sprintf(name, "%s%d", pi->up->devname, pi->portnum); /* IE pmcc4-01) */

Better use snprintf() here, even if the comment above claims the name
never to be no longer than 10 characters.

Cheers
Tobias


\
 
 \ /
  Last update: 2014-03-09 16:43    [W:0.087 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site