Skip to contentSkip to conversation

staging: media: atomisp: Remove unnecessary else after return

PATCH In review Dileep Sankhla 3 participants 8 messages Jul 4 – Jul 6

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: atomisp: Remove unnecessary else after return

Remove unnecessary else clause after return statement as the else branch is not needed when the if branch always returns.

---
 drivers/staging/media/atomisp/pci/hmm/hmm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/hmm/hmm.c +1 -2
index f998b57f90c4..6ff77e053d5d 100644
@@ -235,9 +235,8 @@ static int load_and_flush(ia_css_ptr virt, void *data, unsigned int bytes)
 		vptr = hmm_bo_vmap(bo, true);
 		if (!vptr)
 			return load_and_flush_by_kmap(virt, data, bytes);
-		else
-			vptr = vptr + (virt - bo->start);
 
+		vptr = vptr + (virt - bo->start);
 		memcpy(data, vptr, bytes);
 		clflush_cache_range(vptr, bytes);
 		hmm_bo_vunmap(bo);
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Dileep Sankhla

Remove unnecessary else clause after return statement as the else branch is not needed when the if branch always returns.

Is this the only place (of a such kind) that can be amended in the entire driver?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 2 lines · Andy Shevchenko

Is this the only place (of a such kind) that can be amended in the entire driver?

Hi Andy,

No. There are other places too. I performed a quick check:

$ for f in $(find drivers/staging/media/atomisp -type f -name "*.[ch]"); do
    ./scripts/checkpatch.pl --file --terse "$f" | grep -i "else is not
generally useful"
done
drivers/staging/media/atomisp/pci/sh_css_params.c:2337: WARNING: else
is not generally useful after a break or return
drivers/staging/media/atomisp/pci/sh_css_params.c:3198: WARNING: else
is not generally useful after a break or return
drivers/staging/media/atomisp/pci/sh_css_params.c:4112: WARNING: else
is not generally useful after a break or return
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c:413:
WARNING: else is not generally useful after a break or return
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c:1176:
WARNING: else is not generally useful after a break or return
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c:1221:
WARNING: else is not generally useful after a break or return
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c:1278:
WARNING: else is not generally useful after a break or return
drivers/staging/media/atomisp/pci/atomisp_fops.c:128: WARNING: else is
not generally useful after a break or return
drivers/staging/media/atomisp/pci/atomisp_fops.c:168: WARNING: else is
not generally useful after a break or return
drivers/staging/media/atomisp/pci/atomisp_fops.c:209: WARNING: else is
not generally useful after a break or return
drivers/staging/media/atomisp/pci/atomisp_v4l2.c:471: WARNING: else is
not generally useful after a break or return
drivers/staging/media/atomisp/pci/sh_css.c:7722: WARNING: else is not
generally useful after a break or return
drivers/staging/media/atomisp/pci/sh_css_firmware.c:249: WARNING: else
is not generally useful after a break or return
drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc1_5/ia_css_ctc1_5.host.c:32:
WARNING: else is not generally useful after a break or return

In my patch, I am trying to address the warning only from a single file. If you want, I could try to send a patch addressing all the above warnings.

--
Best Regards,
Dileep Sankhla

#3 lore raw
Quoted 10 lines · Dileep Sankhla
Quoted 2 lines · Andy Shevchenko

Is this the only place (of a such kind) that can be amended in the entire driver?

No. There are other places too. I performed a quick check:

In my patch, I am trying to address the warning only from a single file. If you want, I could try to send a patch addressing all the above warnings.

This is a huge driver and doing half-baked work doesn't make sense. Also if you want to continue working on this driver, get the hardware. Almost any cheap second-hand Bay Trail and Cherry Trail tablet should suffice (of course one needs to check the specifications beforehand to be sure it uses AtomISP camera).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 1 line · Andy Shevchenko

This is a huge driver and doing half-baked work doesn't make sense.

I will try to send a patch addressing all the "else is not generally useful after a break or return" warnings.

Quoted 4 lines

Also if you want to continue working on this driver, get the hardware. Almost any cheap second-hand Bay Trail and Cherry Trail tablet should suffice (of course one needs to check the specifications beforehand to be sure it uses AtomISP camera).

Sorry I cannot get the hardware right now.

--
Best Regards,
Dileep Sankhla

#5 lore raw
Quoted 8 lines · Dileep Sankhla
Quoted 1 line · Andy Shevchenko

This is a huge driver and doing half-baked work doesn't make sense.

I will try to send a patch addressing all the "else is not generally useful after a break or return" warnings.

Quoted 6 lines
Quoted 4 lines

Also if you want to continue working on this driver, get the hardware. Almost any cheap second-hand Bay Trail and Cherry Trail tablet should suffice (of course one needs to check the specifications beforehand to be sure it uses AtomISP camera).

Sorry I cannot get the hardware right now.

I see, but please consider that to have in the future. The driver has tons of work needed to be done, but most of that needs real testing on a real HW.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw
Quoted 3 lines · Andy Shevchenko

I see, but please consider that to have in the future. The driver has tons of work needed to be done, but most of that needs real testing on a real HW.

Sure, I will try.

--
Best Regards,
Dileep Sankhla