Re: [PATCH] scsi: debug: fix type mismatch warning for sg_pcopy_from_buffer

From: Andrew Morton
Date: Wed May 20 2015 - 15:53:36 EST


On Tue, 19 May 2015 23:22:39 +0200 Arnd Bergmann <arnd@xxxxxxxx> wrote:

> The recent change to mark the input argument of sg_pcopy_from_buffer
> had the unfortunate side-effect to cause a new warning in the
> scsi_debug code:
>
> drivers/scsi/scsi_debug.c: In function 'do_device_access':
> drivers/scsi/scsi_debug.c:2376:8: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
> func = sg_pcopy_from_buffer;
>
> This patch attempts to avoid that warning without adding
> evil type casts, but unfortunately makes the do_device_access
> function a lot uglier in the process.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> Fixes: 5250326459 ("lib/scatterlist: mark input buffer parameters as 'const'")
> ---
>
> I can't decide if this is actually a good idea, or if we should rather drop
> the sg_pcopy_from_buffer() patch. Maybe someone else sees a better solution.

Could make do_device_access() call sg_copy_buffer() directly.

But yes, dropping the sg_pcopy_from/to_buffer changes is reasonable.
sg_copy_buffer() is bidirectional and that won't be changing, so
putting constified wrapeprs around it is kinda fake.

--
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/