Re: [PATCH v2 2/2] kexec: fix error propagation in kexec_image_probe_default()

Mike Rapoport <[email protected]>
Newsgroups org.infradead.lists.kexec,dev.linux.lists.loongarch,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Fri, Aug 21, 2026 at 12:48:15PM +0530, Mukesh Pilaniya wrote:
> Hi Philipp,
> 
> On 20/08/26 11:41 pm, Pratyush Yadav wrote:
> > On Thu, Aug 20 2026, Philipp Rudo wrote:
> > 
> >> Hi Mukesh,
> >> Hi Pratyush,
> >>
> >> having this patch makes sense. Personally I'd go with having a
> >> switch-case rather than individual if-blocks. E.g.
> >>
> >> 	switch (ret) {
> >> 		case 0:
> >> 			image->fops = *fops;
> >> 			return 0;
> >> 		case -ENOEXEC:
> >> 			continue;
> >> 		default:
> >> 			return ret;
> >> 	}
> >>
> >> IMHO that is better readable and easier to extend in case other error
> >> codes need special handling as well. But that is only my personal
> >> opinion.
> > 
> > Well, IMO both look roughly the same so I unless Mukesh prefers your
> > version more, we can keep it as-is.
> > 
> Thanks for the review. I agree the switch-case reads nicely, but since
> the current version is functionally equivalent and already
> reviewed, I'll keep it as-is to avoid re-spinning for a style change.
> Happy to switch if you or Pratyush feel strongly about it.

I'd like to request another style change :)

In newer code we often use 'err' rather than 'ret', so it's more obvious
what this variable about.

I don't feel strong about if or switch, but if you go with if, please don't
compare to 0, use !err.

-- 
Sincerely yours,
Mike.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.