Commit 566f26aa705609d05940289036ab914c8a3be707
Committed by
David S. Miller
1 parent
2120c52da6
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
net/caif/cfsrvl.c
... | ... | @@ -211,9 +211,10 @@ |
211 | 211 | void (*put)(struct cflayer *lyr)) |
212 | 212 | { |
213 | 213 | struct cfsrvl *service; |
214 | - service = container_of(adapt_layer->dn, struct cfsrvl, layer); | |
215 | 214 | |
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); | |
217 | 218 | service->hold = hold; |
218 | 219 | service->put = put; |
219 | 220 | } |