Skip to content

Commit 566f26a

Browse files
Wei Yongjundavem330
authored andcommitted
caif: move the dereference below the NULL test
The dereference should be moved below the NULL test. spatch with a semantic match is used to found this. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2120c52 commit 566f26a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎net/caif/cfsrvl.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ void caif_client_register_refcnt(struct cflayer *adapt_layer,
211211
void (*put)(struct cflayer *lyr))
212212
{
213213
struct cfsrvl *service;
214-
service = container_of(adapt_layer->dn, struct cfsrvl, layer);
215214

216-
WARN_ON(adapt_layer == NULL || adapt_layer->dn == NULL);
215+
if (WARN_ON(adapt_layer == NULL || adapt_layer->dn == NULL))
216+
return;
217+
service = container_of(adapt_layer->dn, struct cfsrvl, layer);
217218
service->hold = hold;
218219
service->put = put;
219220
}

0 commit comments

Comments
 (0)