diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index cffd1a9ac763bd33881bcc34a7495232ece32839..d7e895c77e29831dd54b6122411f005be2235b44 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -569,7 +569,7 @@ static void  __attribute__((destructor)) fini_##rwlock(void) \
  * the lock. When the lock goes out of scope, it will automatically
  * be unlocked.
  *
- * \example
+ * \code
  * int some_function(struct ast_channel *chan)
  * {
  *     SCOPED_LOCK(lock, chan, ast_channel_lock, ast_channel_unlock);
@@ -580,6 +580,7 @@ static void  __attribute__((destructor)) fini_##rwlock(void) \
  *
  *     return -1;
  * }
+ * \endcode
  *
  * In the above example, neither return path requires explicit unlocking
  * of the channel.