Re: [PATCH 20/25] drivers/usb: Use static const char arrays

From: Greg KH
Date: Mon Sep 13 2010 - 16:39:04 EST


On Mon, Sep 13, 2010 at 12:47:58PM -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
> drivers/usb/atm/ueagle-atm.c | 14 +++++---------
> drivers/usb/otg/langwell_otg.c | 2 +-
> 2 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
> index ea071a5..00d2516 100644
> --- a/drivers/usb/atm/ueagle-atm.c
> +++ b/drivers/usb/atm/ueagle-atm.c
> @@ -1574,20 +1574,16 @@ static int uea_stat_e4(struct uea_softc *sc)
>
> static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver)
> {
> - char file_arr[] = "CMVxy.bin";
> + char file_arr[sizeof("CMVxy.bin")];
> char *file;
>
> kparam_block_sysfs_write(cmv_file);
> /* set proper name corresponding modem version and line type */
> if (cmv_file[sc->modem_index] == NULL) {
> - if (UEA_CHIP_VERSION(sc) == ADI930)
> - file_arr[3] = '9';
> - else if (UEA_CHIP_VERSION(sc) == EAGLE_IV)
> - file_arr[3] = '4';
> - else
> - file_arr[3] = 'e';
> -
> - file_arr[4] = IS_ISDN(sc) ? 'i' : 'p';
> + sprintf(file_arr, "CMV%c%c.bin",
> + (UEA_CHIP_VERSION(sc) == ADI930) ? '9' :
> + (UEA_CHIP_VERSION(sc) == EAGLE_IV) ? '4' : 'e',
> + IS_ISDN(sc) ? 'i' : 'p');

I despise : ? logic wherever possible, so no, I will not take this
patch, sorry.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/