>> Where did the Coccinelle software get the impression that anything
>> would be added too often at the end of such a function implementation?
>
> Without the semantic patch and the C source code,
You have access to data from both files already.
> I can't answer the question.
Is it more convenient to check test results for attachments again?
Regards,
Markus
@replacement@
expression info, result;
identifier target, work;
type t != void;
@@
t work(...)
{
<+...
if (...)
(
-{
-result = info;
goto
- target
+ e_nodev
;
-}
|
{
...
-result = info;
goto
- target
+ e_nodev
;
}
)
...+>
target:
...
return result;
+e_nodev:
+result = info;
+goto target;
}
// SPDX-License-Identifier: GPL-2.0-or-later
// Deleted part
static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
{
struct megasas_iocpacket __user *user_ioc =
(struct megasas_iocpacket __user *)arg;
struct megasas_iocpacket *ioc;
struct megasas_instance *instance;
int error;
ioc = memdup_user(user_ioc, sizeof(*ioc));
if (IS_ERR(ioc))
return PTR_ERR(ioc);
instance = megasas_lookup_instance(ioc->host_no);
if (!instance) {
error = -ENODEV;
goto out_kfree_ioc;
}
/* Block ioctls in VF mode */
if (instance->requestorId && !allow_vf_ioctls) {
error = -ENODEV;
goto out_kfree_ioc;
}
if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR) {
dev_err(&instance->pdev->dev, "Controller in crit error\n");
error = -ENODEV;
goto out_kfree_ioc;
}
if (instance->unload == 1) {
error = -ENODEV;
goto out_kfree_ioc;
}
if (down_interruptible(&instance->ioctl_sem)) {
error = -ERESTARTSYS;
goto out_kfree_ioc;
}
if (megasas_wait_for_adapter_operational(instance)) {
error = -ENODEV;
goto out_up;
}
error = megasas_mgmt_fw_ioctl(instance, user_ioc, ioc);
out_up:
up(&instance->ioctl_sem);
out_kfree_ioc:
kfree(ioc);
return error;
}
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci