On Wed, May 2, 2018 at 9:21 AM, Martin K. Petersen
<martin.peter...@oracle.com> wrote:
>
> Hi Chaitra,
>
>>>              for (i = 0; i < ioc->combined_reply_index_count; i++) {
>>> -                    ioc->replyPostRegisterIndex[i] = (resource_size_t
>> *)
>>> -                         ((u8 *)&ioc->chip->Doorbell +
>>> +                    ioc->replyPostRegisterIndex[i] =
>>> +                        (volatile void __iomem *)
>>> +                         ((u8 __force *)&ioc->chip->Doorbell +
>>>                           MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET +
>>>                           (i *
>> MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET));
>>
>> Why the double type casts? You've already changed replyPostRegisterIndex
>> to be 'volatile void __iomem **' in the header file. So why not:
>>
>>                         ioc->replyPostRegisterIndex[i] =
>>                                 &ioc->chip->Doorbell +
>>                                 MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET +
>>                                 i * 
>> MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET;
>
> You didn't address my question about why the type casts were required in
> the first place? I get cautious when I see nested casting...
>

Martin,

In v3 patch,we have removed this nested casting and just used (u8
__force) to fix the sparse warning.

~ Sreekanth


>> Also looks like ioc->reply_post_host_index handling a few lines further
>> down could lose the type casts.
>
> See above.
>
> --
> Martin K. Petersen      Oracle Linux Engineering

Reply via email to