Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: liujing <liujing@cmss.chinamobile.com>
Cc: perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: asihpi: Delete redundant judgments
Date: Wed, 04 Dec 2024 10:31:59 +0100	[thread overview]
Message-ID: <87ttbjx08g.wl-tiwai@suse.de> (raw)
In-Reply-To: <20241203154635.2512-1-liujing@cmss.chinamobile.com>

On Tue, 03 Dec 2024 16:46:35 +0100,
liujing wrote:
> 
> Since HPI6205_TIMEOUT is a constant, time_out is always true,
> so unneeded judgments are removed.
> 
> Signed-off-by: liujing <liujing@cmss.chinamobile.com>

Keeping it allows to remove the time_out for experiments, and compiler
would optimize things in anyway, so there must be no code difference
in the end.

Since this doesn't improve things so significantly, I'd rather leave
as is.

And you mixed different fixes (the conversion of printf format) in a
single patch without explanation, too.  Please split, if any.


thanks,

Takashi

> 
> diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
> index c7d7eff86727..391cce428a11 100644
> --- a/sound/pci/asihpi/hpi6205.c
> +++ b/sound/pci/asihpi/hpi6205.c
> @@ -2127,22 +2127,20 @@ static u16 message_response_sequence(struct hpi_adapter_obj *pao,
>  	time_out = HPI6205_TIMEOUT;
>  
>  	/* read the result */
> -	if (time_out) {
> -		if (interface->u.response_buffer.response.size <= phr->size)
> -			memcpy(phr, &interface->u.response_buffer,
> -				interface->u.response_buffer.response.size);
> -		else {
> -			HPI_DEBUG_LOG(ERROR,
> +	if (interface->u.response_buffer.response.size <= phr->size)
> +		memcpy(phr, &interface->u.response_buffer,
> +			interface->u.response_buffer.response.size);
> +	else {
> +		HPI_DEBUG_LOG(ERROR,
>  				"response len %d too big for buffer %d\n",
>  				interface->u.response_buffer.response.size,
>  				phr->size);
> -			memcpy(phr, &interface->u.response_buffer,
> +		memcpy(phr, &interface->u.response_buffer,
>  				sizeof(struct hpi_response_header));
> -			phr->error = HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
> -			phr->specific_error =
> -				interface->u.response_buffer.response.size;
> -			phr->size = sizeof(struct hpi_response_header);
> -		}
> +		phr->error = HPI_ERROR_RESPONSE_BUFFER_TOO_SMALL;
> +		phr->specific_error =
> +			interface->u.response_buffer.response.size;
> +		phr->size = sizeof(struct hpi_response_header);
>  	}
>  	/* set interface back to idle */
>  	send_dsp_command(phw, H620_HIF_IDLE);
> diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
> index 7ceaf6a7a77e..cac5fcaef08b 100644
> --- a/sound/pci/mixart/mixart.c
> +++ b/sound/pci/mixart/mixart.c
> @@ -1320,12 +1320,12 @@ static int snd_mixart_probe(struct pci_dev *pci,
>  			idx = index[dev];
>  		else
>  			idx = index[dev] + i;
> -		snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i);
> +		snprintf(tmpid, sizeof(tmpid), "%s-%u", id[dev] ? id[dev] : "MIXART", i);
>  		err = snd_card_new(&pci->dev, idx, tmpid, THIS_MODULE,
>  				   0, &card);
>  
>  		if (err < 0) {
> -			dev_err(&pci->dev, "cannot allocate the card %d\n", i);
> +			dev_err(&pci->dev, "cannot allocate the card %u\n", i);
>  			snd_mixart_free(mgr);
>  			return err;
>  		}
> @@ -1334,7 +1334,7 @@ static int snd_mixart_probe(struct pci_dev *pci,
>  		snprintf(card->shortname, sizeof(card->shortname),
>  			 "Digigram miXart [PCM #%d]", i);
>  		snprintf(card->longname, sizeof(card->longname),
> -			"Digigram miXart at 0x%lx & 0x%lx, irq %i [PCM #%d]",
> +			"Digigram miXart at 0x%lx & 0x%lx, irq %i [PCM #%u]",
>  			mgr->mem[0].phys, mgr->mem[1].phys, mgr->irq, i);
>  
>  		err = snd_mixart_create(mgr, card, i);
> -- 
> 2.27.0
> 
> 
> 

  reply	other threads:[~2024-12-04  9:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 15:46 [PATCH] ALSA: asihpi: Delete redundant judgments liujing
2024-12-04  9:31 ` Takashi Iwai [this message]
2024-12-04 11:43 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttbjx08g.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=liujing@cmss.chinamobile.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox