scsi: aacraid: fix -Wcast-function-type
Subsystems (2)
PATCH 1/1 scsi: aacraid: fix -Wcast-function-type
correct usage prototype of callback scsi_cmnd.scsi_done() Report by: https://github.com/KSPP/linux/issues/20
--- drivers/scsi/aacraid/aachba.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/aacraid/aachba.c +6 -1
@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)return 0 ; } +static void aac_probe_container_scsi_done (struct scsi_cmnd *scsi_cmnd) +{ +aac_probe_container_callback1 (scsi_cmnd); +} +int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kmalloc (sizeof (*scsicmd),GFP_KERNEL );
@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)return -ENOMEM ; } scsicmd->list.next =NULL ; - scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_callback1; + scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_scsi_done; scsicmd->device = scsidev; scsidev->sdev_state =0 ;
Signature · 1 line
2.20.1
Quoted 26 lines · Phong Tran
correct usage prototype of callback
scsi_cmnd.scsi_done()Report by: https://github.com/KSPP/linux/issues/20Signed-off-by Phong Tran <[email protected]>--- drivers/scsi/aacraid/aachba.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/scsi/aacraid/aachba.c +5
-0@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)return 0 ; } +static void aac_probe_container_scsi_done (struct scsi_cmnd *scsi_cmnd) +{ +aac_probe_container_callback1 (scsi_cmnd); +} +int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kmalloc (sizeof (*scsicmd),GFP_KERNEL );
drivers/scsi/aacraid/aachba.c int aac_probe_container(struct aac_dev *dev, int cid) · line 821
Quoted 8 lines
drivers/scsi/aacraid/aachba.c +1
-1@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)return -ENOMEM ; } scsicmd->list.next =NULL ; - scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_callback1; + scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_scsi_done; scsicmd->device = scsidev; scsidev->sdev_state =0 ;
Since the above cast is not necessary, please remove it.
Thanks,
Bart.
Quoted 32 lines · Bart Van Assche
Quoted 31 lines · Phong Tran
correct usage prototype of callback
scsi_cmnd.scsi_done()Report by: https://github.com/KSPP/linux/issues/20Signed-off-by Phong Tran <[email protected]>--- drivers/scsi/aacraid/aachba.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/scsi/aacraid/aachba.c +6
-1@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)return 0 ; } +static void aac_probe_container_scsi_done (struct scsi_cmnd *scsi_cmnd) +{ +aac_probe_container_callback1 (scsi_cmnd); +} +int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kmalloc (sizeof (*scsicmd),GFP_KERNEL );@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)return -ENOMEM ; } scsicmd->list.next =NULL ; - scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_callback1; + scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_scsi_done;
Quoted 6 lines
drivers/scsi/aacraid/aachba.c int aac_probe_container(struct aac_dev *dev, int cid) · line 821
Quoted 3 lines
drivers/scsi/aacraid/aachba.c +0
-0scsicmd->device = scsidev; scsidev->sdev_state =0 ;Since the above cast is not necessary, please remove it.
yes, sent v2.
Regards,
Phong.
Quoted 4 lines
Thanks,
Bart.
PATCH v2 1/1 scsi: aacraid: fix -Wcast-function-type
In reply to Phong Trancorrect usage prototype of callback scsi_cmnd.scsi_done() Report by: https://github.com/KSPP/linux/issues/20
--- drivers/scsi/aacraid/aachba.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/aacraid/aachba.c +6 -1
@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)return 0 ; } +static void aac_probe_container_scsi_done (struct scsi_cmnd *scsi_cmnd) +{ +aac_probe_container_callback1 (scsi_cmnd); +} +int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kmalloc (sizeof (*scsicmd),GFP_KERNEL );
@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)return -ENOMEM ; } scsicmd->list.next =NULL ; - scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_callback1; + scsicmd->scsi_done = aac_probe_container_scsi_done; scsicmd->device = scsidev; scsidev->sdev_state =0 ;
Signature · 1 line
2.20.1
Quoted 2 lines · Phong Tran
correct usage prototype of callback
scsi_cmnd.scsi_done()Report by: https://github.com/KSPP/linux/issues/20
This description is confusing. I think a better description would have been "Make the aacraid driver -Wcast-function-type clean."
Anyway:
Quoted 3 lines · Phong Tran
correct usage prototype of callback
scsi_cmnd.scsi_done()Report by: https://github.com/KSPP/linux/issues/20
no harm to add:
drivers/scsi/aacraid/aachba.c:813:23: warning: cast between incompatible function types from ‘int (*)(struct scsi_cmnd *)’ to ‘void (*)(struct scsi_cmnd *)’ [-Wcast-function-type]
Quoted 10 lines
Signed-off-by Phong Tran <[email protected]>--- drivers/scsi/aacraid/aachba.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/scsi/aacraid/aachba.c +0
-0
drivers/scsi/aacraid/aachba.c static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd) · line 801
Quoted 4 lines
drivers/scsi/aacraid/aachba.c +1
-0@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)return 0 ; } +static void aac_probe_container_scsi_done (struct scsi_cmnd *scsi_cmnd)
supernit: double whitespace
Quoted 17 lines
drivers/scsi/aacraid/aachba.c +5
-1+{ +aac_probe_container_callback1 (scsi_cmnd); +} +int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kmalloc (sizeof (*scsicmd),GFP_KERNEL );@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)return -ENOMEM ; } scsicmd->list.next =NULL ; - scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_callback1; + scsicmd->scsi_done = aac_probe_container_scsi_done; scsicmd->device = scsidev; scsidev->sdev_state =0 ;
PATCH v3 1/1 scsi: aacraid: cleanup warning cast-function-type
Make the aacraid driver -Wcast-function-type clean Report by: https://github.com/KSPP/linux/issues/20
drivers/scsi/aacraid/aachba.c:813:23:
warning: cast between incompatible function types from 'int (*)(struct scsi_cmnd *)' to 'void (*)(struct scsi_cmnd *)' [-Wcast-function-type]
--- drivers/scsi/aacraid/aachba.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/aacraid/aachba.c +6 -1
@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)return 0 ; } +static void aac_probe_container_scsi_done (struct scsi_cmnd *scsi_cmnd) +{ +aac_probe_container_callback1 (scsi_cmnd); +} +int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kmalloc (sizeof (*scsicmd),GFP_KERNEL );
@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)return -ENOMEM ; } scsicmd->list.next =NULL ; - scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_callback1; + scsicmd->scsi_done = aac_probe_container_scsi_done; scsicmd->device = scsidev; scsidev->sdev_state =0 ;
Signature · 1 line
2.20.1
Re: [PATCH v3] scsi: aacraid: cleanup warning cast-function-type
Quoted 10 lines · Phong Tran
Make the aacraid driver -Wcast-function-type clean Report by: https://github.com/KSPP/linux/issues/20
drivers/scsi/aacraid/aachba.c:813:23:
warning: cast between incompatible function types from 'int (*)(structscsi_cmnd*)' to 'void (*)(structscsi_cmnd*)' [-Wcast-function-type]Reviewed-by Bart van Assche <[email protected]>Signed-off-by Phong Tran <[email protected]>
-Kees
Quoted 32 lines
--- drivers/scsi/aacraid/aachba.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/scsi/aacraid/aachba.c +6
-1@@ -798,6 +798,11 @@ static int aac_probe_container_callback1(struct scsi_cmnd * scsicmd)return 0 ; } +static void aac_probe_container_scsi_done (struct scsi_cmnd *scsi_cmnd) +{ +aac_probe_container_callback1 (scsi_cmnd); +} +int aac_probe_container (struct aac_dev *dev,int cid) {struct scsi_cmnd *scsicmd =kmalloc (sizeof (*scsicmd),GFP_KERNEL );@@ -810,7 +815,7 @@ int aac_probe_container(struct aac_dev *dev, int cid)return -ENOMEM ; } scsicmd->list.next =NULL ; - scsicmd->scsi_done = (void (*)(struct scsi_cmnd *))aac_probe_container_callback1; + scsicmd->scsi_done = aac_probe_container_scsi_done; scsicmd->device = scsidev; scsidev->sdev_state =0 ;Signature · 1 line
2.20.1
Signature · 1 line
Kees Cook
Martin K. Petersen
AppliedRe: [PATCH v3] scsi: aacraid: cleanup warning cast-function-type
In reply to Phong TranPhong,
Quoted 2 lines
Make the aacraid driver -Wcast-function-type clean Report by:
https://github.com/KSPP/linux/issues/20
Applied to 5.7/scsi-queue, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering