Re: [PATCH RESEND v1 2/3] ALSA: hda: cs35l41: Fix endian conversions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 05 Jun 2023 14:50:54 +0200,
Stefan Binding wrote:
> 
> Hi Takashi,
> 
> On 05/06/2023 08:21, Takashi Iwai wrote:
> > On Thu, 25 May 2023 15:59:54 +0200,
> > Stefan Binding wrote:
> >> @@ -379,10 +379,10 @@ static int cs35l41_save_calibration(struct cs35l41_hda *cs35l41)
> >>     				/* Calibration can only be applied
> >> whilst the DSP is not running */
> >>   				ret = cs35l41_apply_calibration(cs35l41,
> >> -								cpu_to_be32(cl->calAmbient),
> >> -								cpu_to_be32(cl->calR),
> >> -								cpu_to_be32(cl->calStatus),
> >> -								cpu_to_be32(cl->calR + 1));
> >> +								(__be32)cpu_to_be32(cl->calAmbient),
> >> +								(__be32)cpu_to_be32(cl->calR),
> >> +								(__be32)cpu_to_be32(cl->calStatus),
> >> +								(__be32)cpu_to_be32(cl->calR + 1));
> > Do we really need those cast?  Even if yes, it must be with __force
> > prefix for the endian cast in general.
> 
> These casts were added because we found some warnings when we ran the
> static analyzer sparse locally.
> I think these warnings are very minor, and we can drop this patch if
> you prefer?

The warnings must be bogus, or maybe pointing to other things?
The cpu_to_be32() macro itself must return a __be32 value, hence it
makes no sense to add an extra cast .

If the static analysis still shows such a warning, it should be fixed
differently -- either fix the analyzer or fix the cpu_to_be32() macro
itself.

The changes of the argument types to __be32 are fine.  I'm arguing
only about those unnecessary cast.


thanks,

Takashi



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux